RFR: [6904367]: (coll) IdentityHashMap is resized before exceeding the expected maximum size

Ivan Gerasimov ivan.gerasimov at oracle.com
Thu Jul 3 16:00:22 UTC 2014


Hello!

IdentityHasMap has a couple of small issues.
The first one is a performance issue: If you create a map, specifying 42 
as the expected number of element, you'll be able to insert only 41 
elements into the preallocated table. Inserting the 42th element will 
trigger resizing of the storage.

Another issue is that resizing occurs only after the element insertion.
In the extreme case it can lead to the situation when the element is 
successfully inserted and then en exception is thrown due the map been 
unable to grow.

Would you please help review the fix?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-6904367
WEBREV: http://cr.openjdk.java.net/~igerasim/6904367/0/webrev/

Sincerely yours,
Ivan




More information about the core-libs-dev mailing list