RFR [10]: 8186517: sun.nio.cs.StandardCharsets$Aliases and ClassMap can be lazily loaded
Claes Redestad
claes.redestad at oracle.com
Wed Aug 23 14:52:30 UTC 2017
Hi,
On 08/21/2017 09:04 PM, Martin Buchholz wrote:
> OK, but ...
>
> I'd like to see further improvements here later, like switching to
> upper case.
>
> I just realized we have
> java/nio/charset/StandardCharsets.java
> sun/nio/cs/StandardCharsets.java
I also realized my previous patch would allocate a new UTF_8 on every
invocation of the
innermost lookup (oops!).
Avoiding the toLower means the non-standard Charset.forName("utf-8")
will take a
slower path (it still works, of course), but removes a few bytecode from
executing during
startup. We still need to key on the lower-case name in the cache for now:
http://cr.openjdk.java.net/~redestad/8186517/jdk.01/
>
> and they both have a UTF_8 field !
Right, this is unfortunate. We could change the
sun.nio.cs.StandardCharsets constants to
something else as they are encapsulated.
Thanks!
/Claes
More information about the nio-dev
mailing list