An implementation of the T1HA (Fast Positive Hash) hash function.
Briefly, it is a portable 64-bit hash function:
- Intended for 64-bit little-endian platforms, predominantly for Elbrus and x86_64, but portable and without penalties it can run on any 64-bit CPU.
- In most cases up to 15% faster than StadtX hash, xxHash, mum-hash, metro-hash, etc. and all others portable hash-functions (which do not use specific hardware tricks).
- Provides a set of terraced hash functions.
- Currently not suitable for cryptography.
- Licensed under zlib License.
To include this crate in your program, add the following to your
[dependencies] t1ha = "0.1"
t1ha in a
T1haHashMap type alias is the easiest way to use the standard library’s
use t1ha::T1haHashMap; let mut map = T1haHashMap::default(); map.insert(1, "one"); map.insert(2, "two"); map = T1haHashMap::with_capacity_and_hasher(10, Default::default()); map.insert(1, "one"); map.insert(2, "two");
Note: the standard library’s
HashMap::with_capacity are only implemented for the
RandomState hasher, so using
Default to get the hasher is the next best option.
t1ha in a
T1haHashSet is a type alias for the standard library’s
HashSet with `t1ha.
use t1ha::T1haHashSet; let mut set = T1haHashSet::default(); set.insert(1); set.insert(2); set = T1haHashSet::with_capacity_and_hasher(10, Default::default()); set.insert(1); set.insert(2);
t1ha can use AES, AVX or AVX2 instructions as hardware acceleration.
||x86 with AES-NI and AVX extensions|
||x86 with AES-NI and AVX2 extensions|
||x86 with AES-NI without AVX extensions|
You could choose the right implementation base on your
$ RUSTFLAGS="-C target-cpu=native" cargo build
rust-t1ha provide a rough performance comparison to other
Rust implemenation of non-cryptographic hash functions, you can run the benchmark base on your envrionment and usage scenario.
$ RUSTFLAGS="-C target-cpu=native" cargo bench
rust-t1ha major focus
Rust implementation, if you intent to use the origin native
t1ha library, please check rust-fasthash project and it's benchmark, which provides a suite of non-cryptographic hash functions from SMHasher.