Get the latest tech news

A Comparison of Arenas in Rust


Sometimes you just really need an arena. Sometimes for performance reasons, other times for lifetime-related reasons. In their most basic forms, they're just a vec with some extra guarantees. However, it's those extra guarantees that matter. I've found myself looking for the right kind of arena too many times, so here's an overview of literally everything there is. I think, let me know if I forgot something.

The simplest kind of arena is built to solve that exact problem, by allocating in large chunks, and promising never to deallocate or move those. Libraries such as elsa or rpds can help you write efficient datastructures, that are immutable, or provide quick clones because they are mostly based on pointers internally. A few arena libraries also provide an alternative set of collections like Vec, String, and pointers like Box and Rc.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of comparison

comparison

Photo of Rust

Rust

Photo of Arenas

Arenas

Related news:

News photo

Guide to Error Handling in Rust

News photo

Techniques for safe garbage collection in Rust

News photo

Small Strings in Rust: smolstr vs. smartstring (2020)