Open stepancheg opened 1 year ago
Also I did another benchmark, comparing implementations, the results for strings of length 0..50 is:
DefaultHasher: avg= 9.365ns std=0.042ns
FnvHasher: avg=12.658ns std=0.104ns
twox_hash::XxHash64: avg=10.186ns std=0.079ns
twox_hash::xxh3::Hash64: avg=38.926ns std=0.145ns
xxhash_rust::xxh64::Xxh64: avg= 9.738ns std=0.032ns
xxhash_rust::xxh3::Xxh3: avg=10.413ns std=0.052ns
This benchmark is a bit harder to publish as standlone example, but anyway, seems like something is broken in twox-hash XXH3 implementation.
Test program:
https://gist.github.com/stepancheg/6b0b493821f162eb5126dbbf2a070887
hashes strings of various lengths and outputs hash duration. Output is not reliable, but relative numbers should be.
On my Apple M1 laptop and twox-hash 1.6.3 the output is:
which means XXH3 implementation is about three times slower than XXHash64.
Documentation of xxh3 page links to the website https://cyan4973.github.io/xxHash/ which says "The latest variant, XXH3, offers improved performance across the board, especially on small data" and posts a table describing the results, while my measurements show the opposite.
If this works as expected, please close the issue.