RFR 8200696 : Optimal initial capacity of java.lang.Class.enumConstantDirectory
Claes Redestad
claes.redestad at oracle.com
Wed Apr 4 06:56:46 UTC 2018
Hi Ivan,
looks good.
Nit: maybe (int)(universe.length / 0.75f) + 1 to keep fp arithmetic to a
minimum.
/Claes
On 2018-04-04 01:22, Ivan Gerasimov wrote:
> Hello!
>
> 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/
>
More information about the core-libs-dev
mailing list