indexmap-rs/indexmap
소개
일관된 순서와 빠른 순회를 제공하는 해시 테이블입니다. 키 또는 순차 인덱스로 항목에 액세스할 수 있습니다
기타 프로젝트측정된 스타 증가
- in 24h
- +11
- in 7 days
- +45
- in 15 days
- +85
- in 1 month
- +97
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalindexmap
A pure-Rust hash table which preserves (in a limited sense) insertion order.
This crate implements compact map and set data-structures, where the iteration order of the keys is independent from their hash or value. It preserves insertion order (except after removals), and it allows lookup of entries by either hash table key or numerical index.
Note: this crate was originally released under the name ordermap,
but it was renamed to indexmap to better reflect its features.
The ordermap crate now exists
as a wrapper over indexmap with stronger ordering properties.
Background
This was inspired by Python 3.6's new dict implementation (which remembers the insertion order and is fast to iterate, and is compact in memory).
Some of those features were translated to Rust, and some were not. The result was indexmap, a hash table that has following properties:
- Order is independent of hash function and hash values of keys.
- Fast to iterate.
- Indexed in compact space.
- Preserves insertion order as long as you don't call
.remove(),.swap_remove(), or other methods that explicitly change order. The alternate.shift_remove()does preserve relative order. - Uses hashbrown for the inner table, just like Rust's libstd
HashMapdoes.
Performance
IndexMap derives a couple of performance facts directly from how it is constructed,
which is roughly:
A raw hash table of key-value indices, and a vector of key-value pairs.
Iteration is very fast since it is on the dense key-values.
Removal is fast since it moves memory areas only in the table, and uses a single swap in the vector.
Lookup is fast-ish because the initial 7-bit hash lookup uses SIMD, and indices are densely stored. Lookup also is slow-ish since the actual key-value pairs are stored separately. (Visible when cpu caches size is limiting.)
In practice,
IndexMaphas been tested out as the hashmap in rustc in PR45282 and the performance was roughly on par across the whole workload.If you want the properties of
IndexMap, or its strongest performance points fits your workload, it might be the best hash table implementation.
Recent Changes
See RELEASES.md.
관련 프로젝트 살펴보기
불러오는 중…