HashMap collision speed (regression 7->8)

Doug Lea dl at cs.oswego.edu
Sat Jan 10 00:20:33 UTC 2015

On 01/09/2015 06:29 PM, Martin Buchholz wrote:
> Given the prevalence of sub-optimal hashcodes, my own intuition is also that
> raising the treeification threshold from 8 will be a win.

That's what I thought at first. But 8 is a better choice for String
and other Comparable keys, which account for the majority of HashMaps
out there. (For non-comparables, infinity is the best threshold.)
How much slower should we make the most common cases to make the others
faster? The only way to decide empirically is to take a large
corpus of programs and vary thresholds. Short of that, speeding up
comparableClassFor is still the best bet for reducing impact on


More information about the core-libs-dev mailing list