Data.HashTable.hashInt seems somewhat sub-optimal

Jan-Willem Maessen jmaessen at alum.mit.edu
Thu Aug 30 08:28:28 EDT 2007


On Aug 30, 2007, at 5:08 AM, Bulat Ziganshin wrote:

> Hello Jan-Willem,
>
> you may be interested to read hashing papers mentioned at
> http://www.encode.ru/forums/index.php?action=vthread&forum=1&topic=413

Not only did I read them, I tried out the Bob Jenkins hash function!

My conclusion is that for Data.HashTable we do not generally need a  
strong hash; we need a reasonable hash that's cheap to evaluate.  The  
mulHi operation is cheap on most architectures (eg a single multiply  
on 32-bit x86).  Remember, for a hash table we're trading off hashing  
cost with the cost of chain traversal.  There are plenty of other  
applications of hashing where we need to do a better job than this.

-Jan

>
>
> -- 
> Best regards,
>  Bulat                            mailto:Bulat.Ziganshin at gmail.com
>



More information about the Libraries mailing list