Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM: optimizing slice #2791

Open
petar-dambovaliev opened this issue Sep 12, 2024 · 0 comments
Open

VM: optimizing slice #2791

petar-dambovaliev opened this issue Sep 12, 2024 · 0 comments

Comments

@petar-dambovaliev
Copy link
Contributor

Optimizing the internal representation of gno slices

A custom data structure where it either holds an array of const N or the current slice implementation.
The empty slots in the array are filled with nil.
When push number N + 1 happens, the elements are moved from the array to the slice.
Statistically, most slices/vectors are of small size. So a reasonable N can be anything up to 10.

This could potentially have several benefits.

  1. Appending up to N does not cause reallocation
  2. Removed 1 layer of heap indirection
  3. Compiler optimizations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

3 participants