int_hash
Very fast, very simple hash algorithm designed for use in integer hash maps & sets.
This crate attempts to provide the fastest option for integer key hashmaps in the Rust language. So the algorithm may change if a better method is found for this use case.
use IntHashMap;
let mut map: = default;
map.insert;
Limitations
int_hash
is valid for use only with integer sized data, ie <= 16 bytes. This is enforced with debug assertions.
Benchmark Performance
For more info see the the full benchmark report.
Hash Algorithm | Integer Sample Set | int_hash is |
---|---|---|
Rust default aka SipHash | ℕ: Natural numbers | 2.57-8.38x faster |
Rust default aka SipHash | Random numbers | 1.17-3.61x faster |
Rust default aka SipHash | 32× table | 1.52-3.09x faster |
fnv |
ℕ: Natural numbers | 1.36-5.27x faster |
fnv |
Random numbers | 0.99-1.83x faster |
fnv |
32× table | 0.60-1.12x faster |
rustc-hash aka fx |
ℕ: Natural numbers | 1.16-2.34x faster |
rustc-hash aka fx |
Random numbers | 0.94-1.10x faster |
rustc-hash aka fx |
32× table | 0.98-1.17x faster |
seahash |
ℕ: Natural numbers | 2.72-9.70x faster |
seahash |
Random numbers | 1.07-2.83x faster |
seahash |
32× table | 1.31-2.10x faster |
twox_hash aka xx |
ℕ: Natural numbers | 2.81-9.19x faster |
twox_hash aka xx |
Random numbers | 1.17-3.91x faster |
twox_hash aka xx |
32× table | 1.52-3.59x faster |