3 ms·
GB/s is a fairly useless metric for hash-functions designed to be used in hash tables. This is because the keys for hash tables are usually very short, and key
by aidenn0 10y ago
GB/s is a fairly useless metric for hash-functions designed to be used in hash tables. This is because the keys for hash tables are usually very short, and keyed hashes can have long setup times. I don't know the speed of sip-hash for bulk data, but I wouldn't be surprised to see that VMAC is probably faster than siphash for large data, but VMAC has a long setup time (on the order of 5000 cycles IIRC compared to siphash24 at on the order of 100).
Heck, for large inputs, python's random hash isn't much faster than hmacmd5, but for 8 byte inputs python's random hash is faster than siphash24.
The better measurement is X hashes per second at N key size, and then perform that at a few key sizes.
[edit]
I finally found a comparison that does this and includes siphash:
http://cglab.ca/~abeinges/blah/hash-rs/ http://cglab.ca/~abeinges/blah/hash-rs/
Note that siphash is competitive with everything except FNV for small inputs, but FNV blows it away up to about 60 bytes.
- loeg 10y agoGood point.
- kibwen 10y ago> but for 8 byte inputs python's random hash is faster > than siphash24. For reference, note that Rust recently switched its default hash function from SipHash 2-4 to SipHash 1-3, which should lead to improved performance while retaining the usual flood-resistant properties (at least, that's what the algorithm's creator advised us to do :P ).
- aidenn0 10y agoAlso python adopted siphash in 3.4, due to security concerns around its hash function (see PEP-456).
- Gankro 10y agoThese benchmarks are out of date -- Rust recently updated its SipHash impl from Sip2-4 to Sip1-3, making it actually the fastest for 8-64 bytes in some workloads (looking at the hashers outside of the context of using them in a map gives deceptive results). (I need to get clearance to post updated results)
- aidenn0 10y agoGood to know. The page I posted was nice in that it listed both (and included BTree for a comparison). I know nothing about how the benchmarks were run, but the fact that it shows varying sizes and shows hashes both in isolation and in a map gave me confidence that someone who knows what they were doing was running the show. I think not looking at both the bare hash performance and the map performance is a bad idea because there are a lot more variables involved testing against a Map, but poor distribution (which ought not be an issue with anything except FNV on that graph) could make a fast hash not useful.