RFR : 8186517: sun.nio.cs.StandardCharsets$Aliases and ClassMap can be lazily loaded
peter.levart at gmail.com
Thu Aug 24 21:18:47 UTC 2017
On 08/24/2017 10:00 PM, Claes Redestad wrote:
> On 2017-08-24 20:06, Claes Redestad wrote:
>>>> Hm... What about aliases? Would you hard-code them in the
>>>> individual Charset classes (UTF_8, US_ASCII, ISO_8859_1)? They are
>>>> currently generated in the body of sun...StandardCharsets.
>>>> Regards, Peter
>>> ...perhaps the generator could be modified to generate a static
>>> method per charset, returning an array of aliases instead of a
>>> static final field. StandardCharsets would become very light then as
>>> its <clinit> would not do much.
>> Right, I was looking at it from a different angle (generate them
>> directly into each corresponding class), but this way is actually
>> much easier and should be easy enough to roll into this patch.
> 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.
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
The startup performance issue has been nicely handled, so this looks
good to me, Claes.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nio-dev