ava-labs / hypersdk

Opinionated Framework for Building Hyper-Scalable Blockchains on Avalanche
Other
200 stars 105 forks source link

[x/programs] Optimize prependLength function #647

Open samliok opened 10 months ago

samliok commented 10 months ago
          Might want to create an issue here to see if we can avoid the extra allocation. 

There's a borsh function that gives you the max-size of the serialized form of T. We could create a vector with max_size + size_of::<Len>() capacity, wrap it in std::io::Cursor, write out 0 as the size, check the final length, then overwrite the prefix.

It's an optimization, so I think this should be done in a follow up.

_Originally posted by @richardpringle in https://github.com/ava-labs/hypersdk/pull/623#discussion_r1415706432_

github-actions[bot] commented 8 months ago

This issue has become stale because it has been open 60 days with no activity. Adding the lifecycle/frozen label will exempt this issue from future lifecycle events.

github-actions[bot] commented 6 months ago

This issue has become stale because it has been open 60 days with no activity. Adding the lifecycle/frozen label will exempt this issue from future lifecycle events.