What does HackerNews think of bumpalo?

A fast bump allocation arena for Rust

Language: Rust

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.

TSC doesn't need to "stick around", right? Just a run-once and the program is over?

In those cases, https://github.com/fitzgen/bumpalo works amazingly as an arena. You can pretty much forget about reference counting and have direct references everywhere in your graph. The disadvantage is that it's hard to modify your tree without leaving memory around.

We use it extensively in http://github.com/dioxusLabs/dioxus and don't need to worry about Rc anywhere in the graph/diffing code.

Rust has an arena allocator too[1], but it is implemented with 165(!!!) usages of unsafe. :)

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