2026-04-23 17:10 UTC
@dystroy@mastodon.dystroy.org maybe consider using an arena or a bumper allocator like bumpalo? It helps greatly with cache locality and makes allocations as fast as they can get. I'm currently working on a language parser, and I'm using it to store all the data of the AST, which is recursively-dependant. If you just use a bumper, remember you will be leaking memory if you need to resize vectors after allocating something else, so you need to be able to predict sizes on most cases or use two or more in tandem.
Replies (1)
-
@dystroy@mastodon.dystroy.org 2026-04-23 17:13
@Alonely0@mastodon.social I'm used to arenas but here the problem wasn't really the speed of the allocations or the locality, it was really the compounded size of the nested structs