Optimize (Linked-)HashMap lookup when backing array is null

Claes Redestad claes.redestad at oracle.com
Tue May 19 19:21:19 UTC 2020


Thanks for producing the simpler variant and getting some comparative
runs done.

On 2020-05-19 19:50, Christoph Dreis wrote:
> I would probably go for the first version although it is a bit more complicated and has the computeIfPresent caveat, because it doesn't slow down the common Map.get() case when the map is actually filled.

It is a bit of step up in complexity, but getting the win without adding
a branch to Map.get() _is_ a nice property.

> 
> Let me know what you think.

If core libs maintainers are fine with the added complexity of your
original patch, I think it looks ok.

/Claes


More information about the core-libs-dev mailing list