FYI<br><br>There's some new hashing functions out there:<br>see <br><br><a href="http://murmurhash.googlepages.com/">http://murmurhash.googlepages.com/</a><br><br>Highlights from the page:<br><p><b>Extremely simple</b> - compiles down to ~52 instructions on x86.</p>
<p><b>Excellent distribution</b> - Passes chi-squared tests for practically all keysets & bucket sizes.</p><p><b>Excellent avalanche behavior</b> - Maximum bias is under 0.5%.<br></p><b>Excellent collision resistance</b> - Passes Bob Jenkin's frog.c torture-test. No collisions possible for 4-byte keys, no small (1- to 7-bit) differentials.<br>
<br>May be one day phash2 will use this one :)<br><br><div class="gmail_quote">2009/5/7 Paulo Sérgio Almeida <span dir="ltr"><<a href="mailto:psa@di.uminho.pt">psa@di.uminho.pt</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
Bjorn Gustavsson wrote:<br>
<br>
> Actually, it produces good hash values for any term *except* atoms.<br>
<br>
</div>More good news. Now I can avoid doing a term_to_binary, and get around<br>
twice the speed for common small terms.<br>
<br>
Thanks Bjorn,<br>
<font color="#888888">/psa<br>
</font><div class="im"><br>
><br>
> If you have term that contains atoms (e.g. atoms in a list or tuple), you<br>
> will probably get a decent hash value anyway because the hash for<br>
> the atoms is mixed into the hash value calculated by the list or the<br>
> tuple.<br>
><br>
> Try:<br>
><br>
> erlang:phash2([a]).<br>
> erlang:phash2([b]).<br>
> erlang:phash2([c]).<br>
><br>
> /Bjorn<br>
<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><br><a href="http://easyerl.blogspot.com/">http://easyerl.blogspot.com/</a><br><a href="http://www.open-tools.org/">http://www.open-tools.org/</a><br><br>