RFR [10]: 8186517: sun.nio.cs.StandardCharsets$Aliases and ClassMap can be lazily loaded

Peter Levart peter.levart at gmail.com
Thu Aug 24 21:25:17 UTC 2017

Hi Claes,

On 08/24/2017 11:18 PM, Peter Levart wrote:
>> Done:
>> http://cr.openjdk.java.net/~redestad/8186517/jdk.03/
>> Manually verified that generated charsets look correct and ran all 
>> charset tests without issue.
>>> Should be a nice reduction in retained objects on minimal apps.
>> 425 fewer objects allocated, -16.5Kb.
>> /Claes
> Very nice!
> The synchronization issue with iteration and unsynchronized lookup() 
> still remains, and it's awkward that init() still has to "patch" the 
> aliases (must the hack remain in place?), but that could be solved in 
> a separate followup issue as well as optimization for public 
> java.nio.charset.StandardCharsets.
> The startup performance issue has been nicely handled, so this looks 
> good to me, Claes.

Maybe just a nit: the constructors of UTF_8, US_ASCII and ISO_8859_1 
could be made private since they should now never need to be invoked 
from outside of class and if there is a bug in code and they do get 
invoked, it's better to see the exception early and fix it...

Regards, Peter

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20170824/0580d71e/attachment-0001.html>

More information about the nio-dev mailing list