| Crates.io | rustc-arena-modified |
| lib.rs | rustc-arena-modified |
| version | 0.1.1 |
| created_at | 2023-07-04 04:58:34.126368+00 |
| updated_at | 2023-07-12 05:15:59.847578+00 |
| description | rustc-arena ported to stable rust with additional features |
| homepage | |
| repository | https://github.com/Jakobeha/rustc-arena-modified |
| max_upload_size | |
| id | 907651 |
| size | 6,622,296 |
Forked from rustc_arena
Cloneing objects and possibly using Rcs, use an Arena and copy the references.typed-arena and bumpalo?rustc_arena_modified::TypedArena allows coalescing and clearing objects behind a mutable reference, while saving the chunks so they don't need to be re-allocated. This is equivalent to calling into_vec and then converting the vector back into an arena, but faster, because you don't need to allocate anything.rustc_arena_modified::TypedArena is also significantly faster at iteration according to the benchmarks (other differences are negligible; see benchmarks)rustc_arena_modified::TypedArena returns a shared reference to allocated values, so it can iterate values behind a shared reference like typed-arena-nomut. Unlike typed-arena-nomut, it can also be no-op converted between rustc_arena_modified::TypedArenaMut, which is the same but returns mutable references. And, you can get iterate mutable element references behind a mutable reference to even the shared arena, because that ensures there are no active shared references.slab feature provides SlabArena, a wrapper for rustc_arena_modified::TypedArena which makes it keep track of freed elements in a linked list so their memory can be reclaimed. This comes with some drawbacks, like the inability to allocate slices in the free list (???: allow slice allocation, just make it not part of the free list?)DroplessArena and Bump (note: maybe Bump is objectively better)A port of rustc_arena into stable rust with the following new features:
TypedArena::iter to iterate over all objects in the arenaTypedArena::retain and TypedArena::clear to coalesce clearing objects behind a mutable reference, while saving the chunks so they don't need to be re-allocated.This library makes heavy use of unsafe and isn't fully tested with MIRI. There are tests for most operations and edge cases, and the base functionality is copied almost verbatim from rustc_arena which is very well-tested. But the extra functionality is much less tested, and especially with the heavy use of unsafe, it shouldn't be used in production.
Overall, performs around the same speed as rustc_arena and typed_arena, except iteration is significantly faster than typed_arena. slab_arena performs noticeably slower.
Licensed under either of
at your option.
Forked from rustc-arena (Github), which is also licensed under MIT "or" Apache 2.0.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.