Experimental hash table implementation in just Rust (stable, no unsafe code).
This is inpired by Python 3.6's new dict implementation (which remembers the insertion order and is fast to iterate, and is compact in memory).
This implementation corresponds to their "compact hash map" idea as it is now, and has consistent order.
Please read the API documentation here
__
__ https://docs.rs/ordermap/
|buildstatus| |crates|_
.. |crates| image:: https://img.shields.io/crates/v/ordermap.svg .. _crates: https://crates.io/crates/ordermap
.. |buildstatus| image:: https://travis-ci.org/bluss/ordermap.svg .. _buildstatus: https://travis-ci.org/bluss/ordermap
Using robin hood hashing just like Rust's libstd HashMap.
Remove is implemented.
Performance (Figures from late 2016)
Interesting Features:
unsafe
.IndexMut
.Where to go from here?
Ideas and PRs for how to implement insertion-order preserving remove (for example tombstones) are welcome.
Idea for more cache efficient lookup (This was implemented in 0.1.2)
Current indices: Vec<Pos>
. Pos
is interpreted as (u32, u32)
more
or less when raw_capacity() fits in 32 bits. Pos then stores both the lower
half of the hash and the entry index.
This means that the hash values in Bucket
don't need to be accessed
while scanning for an entry.
0.2.13
.index()
on the entry types by @garro950.2.12
.with_hasher()
, .hasher()
0.2.11
ExactSizeIterator
for the iterators. By @BineroBox<[Pos]>
internally, saving a word in the OrderMap struct."serde-1"
. By @xfix0.2.10
.drain(..)
by @stevej0.2.9
.is_empty()
by @overvenusPartialEq, Eq
by @overvenus.sorted_by()
0.2.8
values()
and .values_mut()
0.2.7
.retain()
0.2.6
OccupiedEntry::remove_entry
and other minor entry methods,
so that it now has all the features of HashMap
's entries.0.2.5
0.2.4
0.2.3
Entry
for now, so that it works on hashmaps with non-default
hasher. However, there's a lingering compat issue since libstd HashMap
does not parameterize its entries by the hasher (S
typarm)..nth()
0.2.2
0.2.1
0.2.0
.entry()
(the simplest parts of the API).reserve()
(placeholder impl).remove()
as synonym for .swap_remove()
.insert()
to swap value if the entry already exists, and
return Option..get_index(), .get_index_mut(), .swap_remove_index()
,
.get_pair_index(), .get_pair_index_mut()
.0.1.2
Pos
which improves cache utilization
and lookup performance0.1.1