{"id":23892459,"url":"https://github.com/zeozeozeo/contiguous-arena","last_synced_at":"2026-02-24T02:08:40.318Z","repository":{"id":270892555,"uuid":"911767891","full_name":"zeozeozeo/contiguous-arena","owner":"zeozeozeo","description":"Efficient, reusable memory arena for Rust with support for contiguous memory blocks.","archived":false,"fork":false,"pushed_at":"2025-04-26T14:30:40.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T14:43:08.950Z","etag":null,"topics":["allocation","allocator","arena","arena-allocator","arena-memory","buffer","contiguous","contiguous-allocation","contiguous-buffer","memory-management","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/contiguous-arena","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeozeozeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-03T19:56:43.000Z","updated_at":"2025-04-26T14:30:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"df71517b-2abd-4707-aadd-d782bf16bb30","html_url":"https://github.com/zeozeozeo/contiguous-arena","commit_stats":null,"previous_names":["zeozeozeo/contiguous-arena"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zeozeozeo/contiguous-arena","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fcontiguous-arena","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fcontiguous-arena/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fcontiguous-arena/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fcontiguous-arena/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeozeozeo","download_url":"https://codeload.github.com/zeozeozeo/contiguous-arena/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fcontiguous-arena/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29768809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T01:40:24.820Z","status":"online","status_checked_at":"2026-02-24T02:00:07.497Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["allocation","allocator","arena","arena-allocator","arena-memory","buffer","contiguous","contiguous-allocation","contiguous-buffer","memory-management","rust"],"created_at":"2025-01-04T13:47:22.724Z","updated_at":"2026-02-24T02:08:40.301Z","avatar_url":"https://github.com/zeozeozeo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# contiguous-arena\n\n`contiguous-arena` is a Rust crate that provides a memory-efficient, contiguous data structure for managing collections of homogeneously-typed elements. It is designed to handle frequent allocations and deallocations efficiently by reusing freed memory spans.\n\nThe library is designed to allow for allocation of contiguous elements, such that:\n\n1. Appending an arbitrary amount of elements will allocate them in a contiguous memory block (`arena.append(T, count)`)\n2. The arena uses `Vec\u003cT\u003e` as the backing buffer, unlike most arena crates which bundle metadata together with the item. This crate uses 2 additional buffers to store the span metadata, which makes it easier to iterate the arena with crates like `rayon` or share it with the GPU, for example.\n\n## Features\n\n- Memory-efficient storage by reusing freed spans.\n- Contiguous memory layout for improved cache performance, easier iteration and GPU memory sharing.\n- Support for arbitrary owned types. Note that the arena DOES NOT currently run `drop()`! (a PR would be appreciated)\n- Only depends on std. A PR adding `#![no_std]` support would be appreciated.\n\nBe aware of memory fragmentation when using this library: frequest allocations of different sizes will eventually fragment the arena. This crate is ideal for use-cases where most allocations are about the same size.\n\n## Example\n\n```rust\nuse contiguous_arena::Arena;\n\nfn main() {\n    let mut arena: Arena\u003cu8\u003e = Arena::new();\n\n    // Append elements to the arena\n    let handle1 = arena.append(5, 10); // Append 10 elements of value 5\n    let handle2 = arena.append(6, 10); // Append 10 elements of value 6\n\n    // Access elements using handles\n    assert_eq!(arena[handle1], 5);\n    assert_eq!(arena[handle2], 6);\n\n    // Free a span\n    arena.free(handle1);\n\n    // Reuse freed span\n    let handle3 = arena.append(7, 10); // This should reuse the space freed by handle1\n    assert_eq!(handle1, handle3);\n    assert_eq!(arena[handle3], 7);\n}\n```\n\n## Benchmarks and tests\n\nTo run tests, run `cargo test`. To run benchmarks, run `cargo bench` in the project directory. See benchmark results in `target/criterion/report/index.html`.\n\nBenchmark results on an Intel Xeon E5-2690 v3 with 2133 MHz DDR4 quad-channel RAM:\n\n```ignore\nappend 1 element        time:   [122.48 ns 125.71 ns 129.62 ns]\nappend 10 elements      time:   [126.89 ns 129.69 ns 133.18 ns]\nappend 100 elements     time:   [129.01 ns 129.65 ns 130.51 ns]\nfree 10 elements        time:   [185.96 ns 189.48 ns 193.88 ns]\nfree 100 elements       time:   [191.01 ns 191.40 ns 191.93 ns]\nreuse span of 10 elements\n                        time:   [205.49 ns 210.46 ns 216.89 ns]\nreuse span of 100 elements\n                        time:   [266.60 ns 274.03 ns 282.45 ns]\niterate 100 elements    time:   [85.580 ns 87.331 ns 89.547 ns]\niterate 1000 elements   time:   [696.59 ns 715.24 ns 736.26 ns]\niterate and mutate 100 elements\n                        time:   [67.295 ns 67.438 ns 67.636 ns]\niterate and mutate 1000 elements\n                        time:   [625.11 ns 639.24 ns 656.52 ns]\nfetch_if found in 100 elements\n                        time:   [66.565 ns 68.174 ns 70.049 ns]\nfetch_if not found in 1000 elements\n                        time:   [582.72 ns 591.28 ns 603.65 ns]\nfetch_or_append found in 100 elements\n                        time:   [2.5913 ns 2.5918 ns 2.5922 ns]\nfetch_or_append not found in 1000 elements\n                        time:   [585.43 ns 591.74 ns 600.30 ns]\nretain_mut keep half of 100 elements\n                        time:   [325.25 ns 333.94 ns 345.95 ns]\nmixed workload with 100 elements\n                        time:   [433.85 ns 439.76 ns 452.24 ns]\n```\n\n(light travels about 30 meters in 100 nanoseconds)\n\n## License\n\nThe Unlicense (public domain)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeozeozeo%2Fcontiguous-arena","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeozeozeo%2Fcontiguous-arena","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeozeozeo%2Fcontiguous-arena/lists"}