RFR: 8281631: HashMap copy constructor and putAll can over-allocate table [v21]

liach duke at openjdk.java.net
Sun Feb 20 19:14:52 UTC 2022


On Sun, 20 Feb 2022 18:08:24 GMT, XenoAmess <duke at openjdk.java.net> wrote:

> I don't thik it reasonable. or is there eveidence it be?

If this map is too dense, there may be a lot of hash collisions, and the lookup performance would decrease because this hashmap is linear probe than red-black tree buckets like the regular hash map is using. This was effectively trading some memory for better performance. You should run benchmarks to see how bad the lookup performance degrades after you saves memory used by the hash table.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7431


More information about the core-libs-dev mailing list