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.
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.
Performance:
Interesting Features:
unsafe
.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.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