RFR [10]: 8186517: sun.nio.cs.StandardCharsets$Aliases and ClassMap can be lazily loaded
Claes Redestad
claes.redestad at oracle.com
Wed Aug 23 22:13:55 UTC 2017
On 2017-08-23 23:21, Xueming Shen wrote:
> On 8/23/17, 8:48 AM, Claes Redestad wrote:
>>
>> On 08/23/2017 04:52 PM, Claes Redestad wrote:
>>> We still need to key on the lower-case name in the cache for now:
>>>
>>
>> Or perhaps not. Since we're always loading these three Charset on
>> bootstrap now, we might as well initialize them eagerly and bypass
>> the cache entirely (but keep this neatly contained in StandardCharset).
>>
>> This allows us to lazily load the $Cache class too, further reducing
>> work done during System.initPhase1:
>>
>> http://cr.openjdk.java.net/~redestad/8186517/jdk.02/
>>
> if we go that far :-) shouldn't we simply expose the utf8/8859-1/ascii
> charset
> instance directly?
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.
> if we go with String.equals then any reason we still need define the
> String constants?
Not really, no.
> why the signature change in utf8.java for updatePositions()?
This gets rid of a synthetic accessor method, which helps startup a tiny
bit.
/Claes
More information about the nio-dev
mailing list