dysfun@treehouse.systems ("gaytabase") wrote:
so i haven't actually come across a GC that gives a shit about alignment ,which i guess isn't that surprising, since malloc doesn't give a shit about alignment either. i of course wouldn't be happy unless we could do simd at native performance, so it's already been baked in. you kind of get it for free when you go size classes.
remember i was musing about meet in the middle layouts, where you could do 2 sizes? well i came up with a better option: 1 and 3 blocks. each size can store items of 1 or 3 times the base size. no, that doesn't include 2, that would be the next size class up.
because our metadata is reduced to a couple of bits (currently 2) per entry, we can afford to waste the space of 3 elements where only 1 item will go. we can always allocate a 3x anywhere except in the last 2 slots. we can allocate into a space that's being recycled (where some elements are already present in arbitrary slots) by keeping some watermarks and doing a little logic and then finding the next unset bit and its length.
a 1,3,5,7 block would be nice, except that beyond 2 sizes, you have to work harder to avoid leaving gaps, probably at performance cost.