protocompile icon indicating copy to clipboard operation
protocompile copied to clipboard

Add inline and small slices for memory compaction

Open mcy opened this issue 11 months ago • 0 comments

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 avatar Jan 09 '25 15:01 mcy