Hacker News new | past | comments | ask | show | jobs | submit login

Apparently there is a patch for the SMHasher here which adds support for ahash:

https://github.com/tkaitchuck/aHash/tree/master/smhasher

There are also ahash's own benchmarks here:

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.




Interestingly 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!


Added it to 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.


> 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++)


That might be it. gcc 10 with lto only, not clang. I also saw a lot if weird rust exception like functions brought into it.


wyhash 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.


Okay, 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: