Lobsters0 Hot5 phút
Closing a three-year-old issue using Rust arenas
A Gleam core team member resolved a three-year-old GitHub issue by refactoring the language's pretty printer to use arena allocation via the typed_arena crate. By replacing heap-allocated Box<T> with arena-backed references, the formatter became 24% faster and reduced peak memory usage by ~10% (8.4MB to 7.6MB). The post explains the Document recursive data structure, how arenas work in Rust, the lifetime changes required, and the caching benefits of allocating repeated documents only once.