RFR 8200696 : Optimal initial capacity of java.lang.Class.enumConstantDirectory

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Apr 3 23:22:22 UTC 2018


Yet another occurrence of not-optimally pre-sized HashMap.

When java.lang.Class.enumConstantDirectory is created, the initial 
capacity is set to be (2 * universe.length), which is more than 
necessary in some cases.

Choosing the capacity optimally will allow us to save a few bytes with 
some enum classes.

Would you please help review this trivial fix?

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

With kind regards,
Ivan Gerasimov

More information about the core-libs-dev mailing list