[15] RFR (xs) 8046362 IdentityHashMap.hash comments should be clarified

Doug Lea dl at cs.oswego.edu
Fri Feb 7 14:03:50 UTC 2020


On 2/6/20 12:31 PM, Martin Buchholz wrote:
> lgtm
> 
> Knuth didn't like linear probing, but memory locality became far more
> important over time, favoring linear probing.

(Or variants, like cuckoo, but they are unlikely to be improvements here.)

> 
> I don't get what hash() is doing with the low bits. Maybe we want
> something like mix32.

It is mainly spreading them upwards because some (varying over time) top
bits of identityHashCode are always 0.

-Doug


> 
> On Thu, Feb 6, 2020 at 1:01 AM Andrew Haley <aph at redhat.com
> <mailto:aph at redhat.com>> wrote:
> 
>     On 1/28/20 11:41 PM, Stuart Marks wrote:
> 
>     > As an aside, I don't know whether the linear-probing (open
>     > addressed) arrangement of IdentityHashMap is in fact faster than the
>     > separate chaining approach of HashMap. Perhaps investigating that
>     > could be a side project for someone.
> 
>     It always has been better in the past, but maybe if the collision rate
>     is kept low it won't matter much. Deletion is horrible, though.
> 
>     > Changeset appended below.
>     >
>     > Bug: https://bugs.openjdk.java.net/browse/JDK-8046362
> 
>     OK, thanks.
> 
>     -- 
>     Andrew Haley  (he/him)
>     Java Platform Lead Engineer
>     Red Hat UK Ltd. <https://www.redhat.com>
>     https://keybase.io/andrewhaley
>     EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
> 




More information about the core-libs-dev mailing list