is there any reason to use SuperFastHash in druntime? (except speed)

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Wed May 27 20:09:07 PDT 2015


SuperFastHash has known distribution problems[1]. there is fasthash[2] 
function, which is comparable to murmur, but requires one multiplication 
per 8 bytes (and it yields 64-bit hash values) and using ulongs. i think 
that there is some sense in trading some speed for better distribution. 
what do you think?

p.s. i made a stupid tester which using "/usr/share/dict/words" to test 
hashing functions. it hashes each word as all-lower, all-upper and all-
lower with first char as upper. the results are:

fastHash64 ... perfect for 115857 words
fastHash32 ... perfect for 115857 words
sfHash ... 6 collisions in total

that's not that bad, but fasthash is definitely better. ;-)

and i believe that people that care about performance will roll their own 
hash functions anyway, so having not lightning fast, but good hash in 
druntime is better than having fast, but worse function.


[1] google://superfasthash+problems
[2] http://code.google.com/p/fast-hash/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150528/db3b6fd9/attachment.sig>


More information about the Digitalmars-d mailing list