Brian "Krow" Aker (krow) wrote,
Brian "Krow" Aker
krow

No Two Hash are Equal

I have almost always found that the Hsieh alogrithm for hashing turns out to be the fast. So this morning while waiting for a compile I popped it into Memcached to see what the improvement would be:

With Hsieh:
Testing generate_pairs 2.396 [ ok ]
Testing generate_data 5.100 [ ok ]
Testing get_read 5.491 [ ok ]
Testing delete_generate 4.587 [ ok ]
Testing generate_buffer_data 1.361 [ ok ]
Testing delete_buffer 0.880 [ ok ]
Testing generate_data 4.984 [ ok ]
Testing mget_read 1.817 [ ok ]
Testing mget_read_result 1.743 [ ok ]
Testing mget_read_function 1.782 [ ok ]
Testing cleanup 0.046 [ ok ]
Testing generate_large_pairs 0.390 [ ok ]
Testing generate_data 39.899 [ ok ]
Testing generate_buffer_data 0.058 [ ok ]
Testing cleanup 0.001 [ ok ]

With default:
Testing generate_pairs 2.405 [ ok ]
Testing generate_data 5.081 [ ok ]
Testing get_read 5.399 [ ok ]
Testing delete_generate 4.494 [ ok ]
Testing generate_buffer_data 1.284 [ ok ]
Testing delete_buffer 0.894 [ ok ]
Testing generate_data 4.941 [ ok ]
Testing mget_read 1.793 [ ok ]
Testing mget_read_result 1.785 [ ok ]
Testing mget_read_function 1.748 [ ok ]
Testing cleanup 0.037 [ ok ]
Testing generate_large_pairs 0.390 [ ok ]
Testing generate_data 39.897 [ ok ]
Testing generate_buffer_data 0.058 [ ok ]
Testing cleanup 0.001 [ ok ]

It is slower!

Memcached uses the one published by Bob Jenkins (http://burtleburtle.net/bob/hash/doobs.html), and Paul Hsieh wrote originally that his algorithm was faster then Jenkins' (http://www.azillionmonkeys.com/qed/hash.html).

Hmmm something smells fishy...
Subscribe
  • Post a new comment

    Error

    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 5 comments