Hacker News new | ask | show | jobs
by tw061023 1092 days ago
Long story short, heap allocation is painfully slow. Any sort of malloc will always be slower than a custom pool or a bump allocator, because it has a lot more context to deal with.

Rust makes it especially hard to use custom allocators, see bumpalo for example [0]. To be fair, progress is being made in this area [1].

Theoretically one can use a "handle table" as a replacement for pools, you can find relevant discussion at [2].

[0] https://github.com/fitzgen/bumpalo

[1] https://github.com/rust-lang/rust/issues/32838

[2] https://news.ycombinator.com/item?id=36353145

Edit: formatting.