4 ms·
I am also wondering whether ahash is faster. ahash is developed with rust. We need a head to head comparsion. However, it is not available in SMHasher package.
by wangyi_fudan 6y ago
I am also wondering whether ahash is faster. ahash is developed with rust. We need a head to head comparsion. However, it is not available in SMHasher package.
- kouteiheika 6y agoApparently there is a patch for the SMHasher here which adds support for ahash: https://github.com/tkaitchuck/aHash/tree/master/smhasher https://github.com/tkaitchuck/aHash/tree/master/smhasher There are also ahash's own benchmarks here: https://github.com/tkaitchuck/aHash/blob/master/compare/tests/compare.rs https://github.com/tkaitchuck/aHash/blob/master/compare/test... They use the wyhash Rust crate, so if wyhash itself was updated doing a head to head comparison would boil down to updating the wyhash crate and rerunning ahash's benchmark suite.
- wangyi_fudan 6y agowyhash crate is not wyhash itself. It depends on the skill of the translator and the wyhash version. wyhash has been improved significantly version by version. Also ahash should submit a PR to smhasher and play with ~100 other hash functions there.
- kouteiheika 6y agoOkay, I've quickly added the new wyhash to ahash's benchmark suite (the original C version converted to Rust with c2rust so that it can be inlined by the compiler) and reran the benchmarks; here are the results on my machine: 1kb string: - ahash: 23.0ns - wyhash (rust crate): 54.2ns - wyhash (new): 34.8ns u64: - ahash: 0.69ns - wyhash (rust crate): 1.6ns - wyhash (new): 0.97ns So the new version is faster, but it looks like ahash is still state-of-the-art when it comes to speed.
- rurban 6y agoInterestingly this patch never was submitted to me. Just saw it now. Will add it asap. Very interesting is his claim to create wyhash collisions at will. Even with bad keys, not bad seeds!
- rurban 6y agoAdded it to smhasher https://github.com/rurban/smhasher/#smhasher https://github.com/rurban/smhasher/#smhasher It may be the fastest rust hash, but certainly not faster than other fast hashes. More like 2x slower. xxh3, t1ha0, wyhash are all much faster on the 2 machines I tested it on, an old 7 years old Intel i5-2300, and a new Ryzen 3200U.
- kouteiheika 6y ago> It may be the fastest rust hash, but certainly not faster than other fast hashes. More like 2x slower. If it's so much slower then most likely something is wrong. 1) Did you enable the AES instruction when compiling? (IIRC it's disabled by default) 2) When compiling the benchmark did you have cross-language inlining enabled? (IIRC you need to compile your C++ code with a specific version of Clang to get it to inline between Rust and C++)
- rurban 6y agoThat might be it. gcc 10 with lto only, not clang. I also saw a lot if weird rust exception like functions brought into it.