RFR [10]: 8186517: sun.nio.cs.StandardCharsets$Aliases and ClassMap can be lazily loaded
Claes Redestad
claes.redestad at oracle.com
Thu Aug 24 18:06:01 UTC 2017
On 2017-08-24 18:41, Peter Levart wrote:
>
>
> On 08/24/2017 06:35 PM, Peter Levart wrote:
>>
>> On 08/24/2017 12:13 AM, Claes Redestad wrote:
>>>
>>> Why not. If we went as far as to putting them in
>>> java.nio.charset.Charset instead,
>>> we'd not even load sun...StandardCharsets during typical bootstrap,
>>> which would
>>> of course make things even better for startup.
>>
>> 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.
Should be a nice reduction in retained objects on minimal apps.
/Claes
More information about the nio-dev
mailing list