harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [classlib] Some further study on hashcode and HashMap
Date Thu, 05 Jul 2007 10:39:47 GMT
Jimmy,Jing Lv wrote:
>     I'm not strongly against this commit, but just as I explained in
> the first mail, to make the numBuckets a power of two (&(bucketsize -
> 1)) is always good, but the simple right shift (>>2) may cause some
> benchmark improved (properly in these benchmarks hashcode is directly
> identityHashCode) while others are reduced (hashcode are
> user-defined). A known reduced benchmark is specjbb.
>    I don't know when will vm improve their hashcode implementation,
> and different vms will re-act to this at different time, so I doubt
> the best way for applying simply shift ( >>2 ) is waiting for vm to
> improve themselves and do no change to classlib. However this is not a
> very urgent issue :)

Ok, how about we flip it around then.  I'll modify the code to compute

    int bucket = hashCode & (numBuckets - 1);

with the understanding that our current VMs are penalized until they
enhance their identityHashCode implementations?

Anyone object to doing it this way around?


View raw message