On 9/4/07, <b class="gmail_sendername">Thomas Hunger</b> &lt;<a href="mailto:hto@arcor.de">hto@arcor.de</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hello,<br><br>I don&#39;t know much about python internals, so the following might be<br>bogus:<br><br>I replaced unicode_hash and string_hash with the hash function from<br>here: <a href="http://www.azillionmonkeys.com/qed/hash.html">
http://www.azillionmonkeys.com/qed/hash.html</a>.<br><br>Then I ran the following micro-benchmark :<br><br>&nbsp;&nbsp;&nbsp;&nbsp;$ time ./python bench.py<br><br>where bech.py is:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;f = dict((line, nr) for nr, line<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in enumerate(open(&#39;/usr/share/dict/words&#39;,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; encoding=&#39;latin1&#39;).readlines()))<br><br>Python3k original hash: real&nbsp;&nbsp;&nbsp;&nbsp;0m2.210s<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new hash: real&nbsp;&nbsp;&nbsp;&nbsp;0m1.842s<br><br>So maybe this is an interesting hash function?
<br><br>Tom</blockquote><div><br>Sounds like a great idea to me.&nbsp; Can you submit it as a patch?<br><br>We should run some more realistic perf tests and profiles but I imagine the impact will only be good.<br><br>-gps<br></div>
</div>