RFR (XS): 8148044: Remove Enum[0] constants from EnumSet and EnumMap

Claes Redestad claes.redestad at oracle.com
Fri Jan 22 12:19:18 UTC 2016

On 2016-01-22 12:57, Aleksey Shipilev wrote:
> On 01/22/2016 02:34 PM, Claes Redestad wrote:
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8148044
>> Webrev: http://cr.openjdk.java.net/~redestad/8148044/webrev.01/
> -1, sorry.
> I would actually suggest keeping the ZERO_ARRAY in Enum*, because enums
> often have small cardinality, and there dodging an allocation matters.
> I'd also make sure we have all ZERO_ARRAY declarations like that as
> "static final".

Sure, I realized we can have the cake and eat it by moving the ZERO_ARRAY*
into the SerializationProxy class: this way we get the miniscule benefit 
of having
a cached empty array while deferring the miniscule cost of the 
Enum[].class load
until we actually serialize an EnumSet (if ever).




More information about the core-libs-dev mailing list