$./bin/googlehash 512 1000000
google hash 0.0765907 255374889 2.18324e+10
bob jenkins hash 0.0158996 255484409 2.18324e+10
google is 0.207592x faster
bob is 4.81714x faster
$./bin/googlehash 29 1000000
google hash 0.0478618 14000129 6.99994e+07
bob jenkins hash 0.0158052 13999989 6.99994e+07
google is 0.330225x faster
bob is 3.02824x faster
./bin/googlehash 65536 1000000
google hash 0.117784 32781492370 3.57002e+14
bob jenkins hash 0.0162152 32744680953 3.57004e+14
google is 0.137668x faster
bob is 7.26383x faster
print out is time(s), sum, variance (could use a suggestion on better test for uniformity - only other idea was look at a histogram, anyone have suggestions?).
edit: it is likely that this is a poor comparison :-)
$ ./a.out 1000 1002 100001
google hash 0.0343956 49967527 8.34091e+09, different bins 207
bob jenkins hash 0.0039651 50033275 8.34095e+09, different bins 99794
google is 0.115279x faster
bob is 8.67458x faster
google moved 0.206998x% objects
bob moved 99.793x% objects
optimal distribution required 200 movements (0.199998%)
bob is performing extremely bad.
edit: updated the gist to include the integer version
Also, the google algorithm does O(log(bins)) iterations in the loop, which explains the speed advantage of bob one. Given the task accomplished, it's really efficient and near optimal.
$./bin/googlehash 512 1000000 google hash 0.0765907 255374889 2.18324e+10 bob jenkins hash 0.0158996 255484409 2.18324e+10 google is 0.207592x faster bob is 4.81714x faster
$./bin/googlehash 29 1000000 google hash 0.0478618 14000129 6.99994e+07 bob jenkins hash 0.0158052 13999989 6.99994e+07 google is 0.330225x faster bob is 3.02824x faster
./bin/googlehash 65536 1000000 google hash 0.117784 32781492370 3.57002e+14 bob jenkins hash 0.0162152 32744680953 3.57004e+14 google is 0.137668x faster bob is 7.26383x faster
print out is time(s), sum, variance (could use a suggestion on better test for uniformity - only other idea was look at a histogram, anyone have suggestions?).
edit: it is likely that this is a poor comparison :-)