Hacker News new | ask | show | jobs
by emtel 25 days ago
I’m not sure how applicable this is today. It is quite hard to beat jemalloc, especially for small allocations, which it handles essentially the same way a hand coded pool or arena would anyway.
2 comments

If using 32bit handles, you save 4 bytes per reference compared to pointers. If your application uses a lot of references, this can add up (in total memory use).

I have a few applications with lots of tree structures, where this makes a meaningful difference.

It's not just memory savings, it's also about CPU cache. A frequently accessed tree/graph-like data structure can fit into L2/L3 cache so much easier if it uses 32-bit offsets instead of pointers.
I’ve worked on game engines and what he’s describing is still very common

I don’t know about outside that world though

Also something not discussed is that you kind of want handles anyway for serializing objects that reference eachother