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

Add inline and small slices for memory compaction #420

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mcy
Copy link
Member

@mcy mcy commented Jan 9, 2025

Go's slices are quite large: 24 bytes on most platforms that will run Protocompile. We can use these bytes to store integer data inline, instead of having to make an allocation for each non-empty slice.

This PR adds slicesx.Inline, which is a slice of integers that stores very small arrays where the length/capacity would normally live. It also adds slicesx.Small, which is a slice without a capacity; this will be useful for the IR package, which will tend to have more immutable slices in it.

@mcy mcy requested a review from jhump January 9, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant