{"id":13672424,"url":"https://github.com/wvwwvwwv/scalable-concurrent-containers","last_synced_at":"2025-12-12T16:39:48.271Z","repository":{"id":40368421,"uuid":"307637153","full_name":"wvwwvwwv/scalable-concurrent-containers","owner":"wvwwvwwv","description":"A collection of high-performance containers providing both asynchronous and synchronous interfaces","archived":false,"fork":false,"pushed_at":"2025-12-05T11:07:36.000Z","size":2377,"stargazers_count":493,"open_issues_count":10,"forks_count":29,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-12-05T11:56:54.320Z","etag":null,"topics":["asynchronous","concurrency","concurrent-data-structure","concurrent-hashmap","concurrent-programming","concurrent-trees","epoch-based-reclamation","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wvwwvwwv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-10-27T08:45:41.000Z","updated_at":"2025-12-04T03:39:00.000Z","dependencies_parsed_at":"2023-02-16T05:45:28.137Z","dependency_job_id":"de15f7f7-720b-4d77-b2b7-ac5268db3d1a","html_url":"https://github.com/wvwwvwwv/scalable-concurrent-containers","commit_stats":{"total_commits":752,"total_committers":7,"mean_commits":"107.42857142857143","dds":"0.12765957446808507","last_synced_commit":"99add3a862099f0bda9d8d5d65ea4fbbc020f9df"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/wvwwvwwv/scalable-concurrent-containers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvwwvwwv%2Fscalable-concurrent-containers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvwwvwwv%2Fscalable-concurrent-containers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvwwvwwv%2Fscalable-concurrent-containers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvwwvwwv%2Fscalable-concurrent-containers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wvwwvwwv","download_url":"https://codeload.github.com/wvwwvwwv/scalable-concurrent-containers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvwwvwwv%2Fscalable-concurrent-containers/sbom","scorecard":{"id":24657,"data":{"date":"2025-07-07","repo":{"name":"github.com/wvwwvwwv/scalable-concurrent-containers","commit":"2ce0d97f88b95980a79c1281e92e2b96d1f577c5"},"scorecard":{"version":"v5.2.1-18-gbb9c347d","commit":"bb9c347dff6349d986baab6578a46d68a5524c62"},"score":4.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":5,"reason":"4 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/scc.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scc.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/wvwwvwwv/scalable-concurrent-containers/scc.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/scc.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/wvwwvwwv/scalable-concurrent-containers/scc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scc.yml:98: update your workflow using https://app.stepsecurity.io/secureworkflow/wvwwvwwv/scalable-concurrent-containers/scc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scc.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/wvwwvwwv/scalable-concurrent-containers/scc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scc.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/wvwwvwwv/scalable-concurrent-containers/scc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scc.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/wvwwvwwv/scalable-concurrent-containers/scc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scc.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/wvwwvwwv/scalable-concurrent-containers/scc.yml/main?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-14T17:35:59.811Z","repository_id":40368421,"created_at":"2025-08-14T17:35:59.811Z","updated_at":"2025-08-14T17:35:59.811Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27686329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"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":["asynchronous","concurrency","concurrent-data-structure","concurrent-hashmap","concurrent-programming","concurrent-trees","epoch-based-reclamation","rust"],"created_at":"2024-08-02T09:01:35.253Z","updated_at":"2025-12-12T16:39:48.263Z","avatar_url":"https://github.com/wvwwvwwv.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Scalable Concurrent Containers\n\n[![Cargo](https://img.shields.io/crates/v/scc)](https://crates.io/crates/scc)\n![Crates.io](https://img.shields.io/crates/l/scc)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/wvwwvwwv/scalable-concurrent-containers/scc.yml?branch=main)\n\nA collection of high-performance containers providing both asynchronous and synchronous interfaces.\n\n#### Features\n\n- Provides both asynchronous and synchronous interfaces.\n- SIMD lookup to scan multiple entries in parallel: requires `RUSTFLAGS='-C target_feature=+avx2'` on `x86_64`.\n- [`Equivalent`](https://github.com/indexmap-rs/equivalent), [`Loom`](https://github.com/tokio-rs/loom) and [`Serde`](https://github.com/serde-rs/serde) support: `features = [\"equivalent\", \"loom\", \"serde\"]`.\n\n#### Concurrent Containers\n\n- [`HashMap`](#hashmap) is a concurrent hash map.\n- [`HashSet`](#hashset) is a concurrent hash set.\n- [`HashIndex`](#hashindex) is a read-optimized concurrent hash map.\n- [`HashCache`](#hashcache) is a 32-way associative concurrent cache backed by [`HashMap`](#hashmap).\n- [`TreeIndex`](#treeindex) is a read-optimized concurrent B-plus tree.\n\n## `HashMap`\n\n[`HashMap`](#hashmap) is a concurrent hash map optimized for highly parallel write-heavy workloads. [`HashMap`](#hashmap) is structured as a lock-free stack of entry bucket arrays. The entry bucket array is managed by [`sdd`](https://crates.io/crates/sdd), thus enabling lock-free access to it and non-blocking container resizing. Each bucket is a fixed-size array of entries, protected by a read-write lock that simultaneously provides blocking and asynchronous methods.\n\n### Locking behavior\n\n#### Entry access: fine-grained locking\n\nRead/write access to an entry is serialized by the read-write lock in the bucket containing the entry. There are no container-level locks; therefore, the larger the container gets, the lower the chance of the bucket-level lock being contended.\n\n#### Resize: lock-free\n\nResizing of a [`HashMap`](#hashmap) is entirely non-blocking and lock-free; resizing does not block any other read/write access to the container or resizing attempts. _Resizing is analogous to pushing a new bucket array into a lock-free stack_. Each entry in the old bucket array will be incrementally relocated to the new bucket array upon future access to the container, and the old bucket array will eventually be dropped after it becomes empty.\n\n### Examples\n\nIf the key is unique, an entry can be inserted. The inserted entry can be updated, read, and removed synchronously or asynchronously.\n\n```rust\nuse scc::HashMap;\n\nlet hashmap: HashMap\u003cu64, u32\u003e = HashMap::default();\n\nassert!(hashmap.insert_sync(1, 0).is_ok());\nassert!(hashmap.insert_sync(1, 1).is_err());\nassert_eq!(hashmap.upsert_sync(1, 1).unwrap(), 0);\nassert_eq!(hashmap.update_sync(\u00261, |_, v| { *v = 3; *v }).unwrap(), 3);\nassert_eq!(hashmap.read_sync(\u00261, |_, v| *v).unwrap(), 3);\nassert_eq!(hashmap.remove_sync(\u00261).unwrap(), (1, 3));\n\nhashmap.entry_sync(7).or_insert(17);\nassert_eq!(hashmap.read_sync(\u00267, |_, v| *v).unwrap(), 17);\n\nlet future_insert = hashmap.insert_async(2, 1);\nlet future_remove = hashmap.remove_async(\u00261);\n```\n\nThe `Entry` API of [`HashMap`](#hashmap) is helpful if the workflow is complicated.\n\n```rust\nuse scc::HashMap;\n\nlet hashmap: HashMap\u003cu64, u32\u003e = HashMap::default();\n\nhashmap.entry_sync(3).or_insert(7);\nassert_eq!(hashmap.read_sync(\u00263, |_, v| *v), Some(7));\n\nhashmap.entry_sync(4).and_modify(|v| { *v += 1 }).or_insert(5);\nassert_eq!(hashmap.read_sync(\u00264, |_, v| *v), Some(5));\n```\n\n[`HashMap`](#hashmap) does not provide an [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) since it is impossible to confine the lifetime of [`Iterator::Item`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#associatedtype.Item) to the [Iterator](https://doc.rust-lang.org/std/iter/trait.Iterator.html). The limitation can be circumvented by relying on interior mutability, e.g., letting the returned reference hold a lock. However, it may lead to a deadlock if not correctly used, and frequent acquisition of locks may impact performance. Therefore, [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) is not implemented; instead, [`HashMap`](#hashmap) provides several methods to iterate over entries synchronously or asynchronously: `iter_{async|sync}`, `iter_mut_{async|sync}`, `retain_{async|sync}`, `begin_{async|sync}`, `OccupiedEntry::next_{async|sync}`, and `OccupiedEntry::remove_and_{async|sync}`\n\n```rust\nuse scc::HashMap;\n\nlet hashmap: HashMap\u003cu64, u32\u003e = HashMap::default();\n\nassert!(hashmap.insert_sync(1, 0).is_ok());\nassert!(hashmap.insert_sync(2, 1).is_ok());\n\n// Entries can be modified or removed via `retain_sync`.\nlet mut acc = 0;\nhashmap.retain_sync(|k, v_mut| { acc += *k; *v_mut = 2; true });\nassert_eq!(acc, 3);\nassert_eq!(hashmap.read_sync(\u00261, |_, v| *v).unwrap(), 2);\nassert_eq!(hashmap.read_sync(\u00262, |_, v| *v).unwrap(), 2);\n\n// `iter_sync` returns `true` when all the entries satisfy the predicate.\nassert!(hashmap.insert_sync(3, 2).is_ok());\nassert!(!hashmap.iter_sync(|k, _| *k == 3));\n\n// Multiple entries can be removed through `retain_sync`.\nhashmap.retain_sync(|k, v| *k == 1 \u0026\u0026 *v == 2);\n\n// `hash_map::OccupiedEntry` also can return the next closest occupied entry.\nlet first_entry = hashmap.begin_sync();\nassert_eq!(*first_entry.as_ref().unwrap().key(), 1);\nlet second_entry = first_entry.and_then(|e| e.next_sync());\nassert!(second_entry.is_none());\n\nfn is_send\u003cT: Send\u003e(f: \u0026T) -\u003e bool {\n    true\n}\n\n// Asynchronous iteration over entries using `iter_async`.\nlet future_scan = hashmap.iter_async(|k, v| { println!(\"{k} {v}\"); true });\nassert!(is_send(\u0026future_scan));\n\n// Asynchronous iteration over entries using the `Entry` API.\nlet future_iter = async {\n    let mut iter = hashmap.begin_async().await;\n    while let Some(entry) = iter {\n        // `OccupiedEntry` can be sent across awaits and threads.\n        assert!(is_send(\u0026entry));\n        assert_eq!(*entry.key(), 1);\n        iter = entry.next_async().await;\n    }\n};\nassert!(is_send(\u0026future_iter));\n```\n\n## `HashSet`\n\n[`HashSet`](#hashset) is a special version of [`HashMap`](#hashmap) where the value type is `()`.\n\n### Examples\n\nMost [`HashSet`](#hashset) methods are identical to those of [`HashMap`](#hashmap) except that they do not receive a value argument, and some [`HashMap`](#hashmap) methods for value modification are not implemented for [`HashSet`](#hashset).\n\n```rust\nuse scc::HashSet;\n\nlet hashset: HashSet\u003cu64\u003e = HashSet::default();\n\nassert!(hashset.read_sync(\u00261, |_| true).is_none());\nassert!(hashset.insert_sync(1).is_ok());\nassert!(hashset.read_sync(\u00261, |_| true).unwrap());\n\nlet future_insert = hashset.insert_async(2);\nlet future_remove = hashset.remove_async(\u00261);\n```\n\n## `HashIndex`\n\n[`HashIndex`](#hashindex) is a read-optimized version of [`HashMap`](#hashmap). In a [`HashIndex`](#hashindex), not only is the memory of the bucket array managed by [`sdd`](https://crates.io/crates/sdd), but also that of entry buckets is protected by [`sdd`](https://crates.io/crates/sdd), enabling lock-free read access to individual entries.\n\n### Entry lifetime\n\nThe `HashIndex` does not drop removed entries immediately; instead, they are dropped only when the bucket is accessed again after the [`sdd`](https://crates.io/crates/sdd) mechanism ensures there are no potential readers for those entries. This implies that a removed entry may persist as long as there are potential readers or the bucket remains unaccessed. As a result, `HashIndex` is not an optimal choice for workloads that are write-heavy and involve large entry sizes.\n\n### Examples\n\nThe `peek` and `peek_with` methods are completely lock-free.\n\n```rust\nuse scc::HashIndex;\n\nlet hashindex: HashIndex\u003cu64, u32\u003e = HashIndex::default();\n\nassert!(hashindex.insert_sync(1, 0).is_ok());\n\n// `peek` and `peek_with` are lock-free.\nassert_eq!(hashindex.peek_with(\u00261, |_, v| *v).unwrap(), 0);\n\nlet future_insert = hashindex.insert_async(2, 1);\nlet future_remove = hashindex.remove_if_async(\u00261, |_| true);\n```\n\nThe `Entry` API of [`HashIndex`](#hashindex) can update an existing entry.\n\n```rust\nuse scc::HashIndex;\n\nlet hashindex: HashIndex\u003cu64, u32\u003e = HashIndex::default();\nassert!(hashindex.insert_sync(1, 1).is_ok());\n\nif let Some(mut o) = hashindex.get_sync(\u00261) {\n    // Create a new version of the entry.\n    o.update(2);\n};\n\nif let Some(mut o) = hashindex.get_sync(\u00261) {\n    // Update the entry in place.\n    unsafe { *o.get_mut() = 3; }\n};\n```\n\nAn [`Iterator`](https://doc.rust-lang.org/std/iter/trait.Iterator.html) is implemented for [`HashIndex`](#hashindex).\n\n```rust\nuse scc::{Guard, HashIndex};\n\nlet hashindex: HashIndex\u003cu64, u32\u003e = HashIndex::default();\n\nassert!(hashindex.insert_sync(1, 0).is_ok());\n\n// Existing values can be replaced with a new one.\nhashindex.get_sync(\u00261).unwrap().update(1);\n\nlet guard = Guard::new();\n\n// An `Guard` has to be supplied to `iter`.\nlet mut iter = hashindex.iter(\u0026guard);\n\nlet entry_ref = iter.next().unwrap();\nassert_eq!(iter.next(), None);\n```\n\n## `HashCache`\n\n[`HashCache`](#hashcache) is a 32-way associative concurrent cache based on the [`HashMap`](#hashmap) implementation. [`HashCache`](#hashcache) does not keep track of the least recently used entry in the entire cache. Instead, each bucket maintains a doubly linked list of occupied entries, which is updated on entry access.\n\n### Examples\n\nThe LRU entry in a bucket is evicted when a new entry is inserted, and the bucket is full.\n\n```rust\nuse scc::HashCache;\n\nlet hashcache: HashCache\u003cu64, u32\u003e = HashCache::with_capacity(100, 2000);\n\n/// The capacity cannot exceed the maximum capacity.\nassert_eq!(hashcache.capacity_range(), 128..=2048);\n\n/// If the bucket corresponding to `1` or `2` is full, the LRU entry will be evicted.\nassert!(hashcache.put_sync(1, 0).is_ok());\nassert!(hashcache.put_sync(2, 0).is_ok());\n\n/// `1` becomes the most recently accessed entry in the bucket.\nassert!(hashcache.get_sync(\u00261).is_some());\n\n/// An entry can be normally removed.\nassert_eq!(hashcache.remove_sync(\u00262).unwrap(), (2, 0));\n```\n\n## `TreeIndex`\n\n[`TreeIndex`](#treeindex) is a B-plus tree variant optimized for read operations. [`sdd`](https://crates.io/crates/sdd) protects the memory used by individual entries, thus enabling lock-free read access to them.\n\n### Locking behavior\n\nRead access is always lock-free and non-blocking. Write access to an entry is lock-free and non-blocking as long as no structural changes are required. However, when nodes are split or merged by a write operation, other write operations on keys in the affected range are blocked.\n\n### Entry lifetime\n\n`TreeIndex` does not drop removed entries immediately. Instead, they are dropped when the leaf node is cleared or split, making `TreeIndex` a suboptimal choice if the workload is write-heavy.\n\n### Examples\n\nIf the key is unique, an entry can be inserted, read, and removed afterward. Locks are acquired or awaited only when internal nodes are split or merged.\n\n```rust\nuse scc::TreeIndex;\n\nlet treeindex: TreeIndex\u003cu64, u32\u003e = TreeIndex::new();\n\nassert!(treeindex.insert_sync(1, 2).is_ok());\n\n// `peek` and `peek_with` are lock-free.\nassert_eq!(treeindex.peek_with(\u00261, |_, v| *v).unwrap(), 2);\nassert!(treeindex.remove_sync(\u00261));\n\nlet future_insert = treeindex.insert_async(2, 3);\nlet future_remove = treeindex.remove_if_async(\u00261, |v| *v == 2);\n```\n\nEntries can be scanned without acquiring any locks.\n\n```rust\nuse scc::TreeIndex;\nuse sdd::Guard;\n\nlet treeindex: TreeIndex\u003cu64, u32\u003e = TreeIndex::new();\n\nassert!(treeindex.insert_sync(1, 10).is_ok());\nassert!(treeindex.insert_sync(2, 11).is_ok());\nassert!(treeindex.insert_sync(3, 13).is_ok());\n\nlet guard = Guard::new();\n\n// `iter` iterates over entries without acquiring a lock.\nlet mut iter = treeindex.iter(\u0026guard);\nassert_eq!(iter.next().unwrap(), (\u00261, \u002610));\nassert_eq!(iter.next().unwrap(), (\u00262, \u002611));\nassert_eq!(iter.next().unwrap(), (\u00263, \u002613));\nassert!(iter.next().is_none());\n```\n\nA specific range of keys can be scanned.\n\n```rust\nuse scc::{Guard, TreeIndex};\n\nlet treeindex: TreeIndex\u003cu64, u32\u003e = TreeIndex::new();\n\nfor i in 0..10 {\n    assert!(treeindex.insert_sync(i, 10).is_ok());\n}\n\nlet guard = Guard::new();\n\nassert_eq!(treeindex.range(1..1, \u0026guard).count(), 0);\nassert_eq!(treeindex.range(4..8, \u0026guard).count(), 4);\nassert_eq!(treeindex.range(4..=8, \u0026guard).count(), 5);\n```\n\n## Performance\n\n### SIMD support\n\n[`HashMap`](#hashmap) is optimized for 256-bit SIMD instructions. Therefore, it is recommended to compile with `avx2` or equivalent options on `x86-64` targets, or with respective features on other platforms.\n\n* Note that Apple M-series CPUs do not support the 256-bit SIMD instructions required for optimal performance.\n\n### [`HashMap`](#hashmap) Tail Latency\n\nThe expected tail latency of a distribution of latencies of 1048576 insertion operations (`K = u64, V = u64`) is less than 50 microseconds on Apple M4 Pro.\n\n### [`HashMap`](#hashmap) and [`HashIndex`](#hashindex) Throughput\n\n- [Results on Apple M4 Pro (12 cores)](https://github.com/wvwwvwwv/conc-map-bench).\n- [Results on Intel Xeon (48 cores, avx2)](https://github.com/wvwwvwwv/conc-map-bench/tree/Intel).\n\n## [Changelog](https://github.com/wvwwvwwv/scalable-concurrent-containers/blob/main/CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvwwvwwv%2Fscalable-concurrent-containers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwvwwvwwv%2Fscalable-concurrent-containers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvwwvwwv%2Fscalable-concurrent-containers/lists"}