<div dir="ltr"><div>Yeah, I don&#39;t think you could extract the hash from the &quot;cache of hashes&quot; without computing the hash in the first place...<br><br></div>My idea was to wrap the key in a KeyWithHash object and cache the hash there (since we&#39;re looking up the same key in a lot of maps during a single invocation). <br>

<br>Sorry Galder, I forgot about your patch, but I still think we&#39;d need a wrapper for keys in order to cache the hash code even if we could define an Equivalence function.<br><br><br></div><div class="gmail_extra"><br>

<br><div class="gmail_quote">On Thu, Apr 25, 2013 at 2:27 PM, Sanne Grinovero <span dir="ltr">&lt;<a href="mailto:sanne@infinispan.org" target="_blank">sanne@infinispan.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On 25 April 2013 11:51, Galder Zamarreño &lt;<a href="mailto:galder@redhat.com">galder@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On Apr 22, 2013, at 3:09 PM, Dan Berindei &lt;<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Mon, Apr 22, 2013 at 2:37 PM, Sanne Grinovero &lt;<a href="mailto:sanne@infinispan.org">sanne@infinispan.org</a>&gt; wrote:<br>
&gt;&gt; We also have been toying with the idea to hash each key only once,<br>
&gt;&gt; instead of both with the consistent hash (to assign the node owner)<br>
&gt;&gt; and once in the CHM backing the datacontainer.<br>
&gt;&gt; I doubt we need the datacontainer to implement Map at all, but at<br>
&gt;&gt; least if we go this way we don&#39;t want the hash to be affected by the<br>
&gt;&gt; VM instance or different nodes won&#39;t agree on the expected owner ;-)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; For consistent hashing it would probably be better to cache the hash after applying MurmurHash to it anyway. So we could in theory hack our CHMV8 to use a cached hash code computed with MurmurHash and a cluster-specific salt.<br>


&gt;<br>
&gt; ^ Rather than hacking CHMv8, better to provide an Equivalence function (which CHMv8 will have an instance variable of) for the keys which keeps the cache of hashes or something… once that work is committed, we can discuss further :)<br>


<br>
</div>+1 to use your cool implementation. Don&#39;t like too much the sound of<br>
&quot;cache the hashes or something&quot;, I didn&#39;t actually look at the code,<br>
but from gut feeling I would hope the Equivalence function to be<br>
stateless? We might be able to pass the to-be-reused hash as a<br>
parameter in primitive form.<br>
<span class="HOEnZb"><font color="#888888"><br>
Sanne<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></div></div></blockquote></div><br></div>