RFR : 8186517: sun.nio.cs.StandardCharsets$Aliases and ClassMap can be lazily loaded
claes.redestad at oracle.com
Mon Aug 21 13:46:57 UTC 2017
the Aliases and Classes inner classes in StandardCharsets can be
lazily-loaded by restructuring how we check for the three
default-loaded charsets. This removes some classloading and
work from happening during critical phases of the VM startup,
as well as a net gain on any systems that default to any of the
three standard charsets (UTF-8, Latin-1, ASCII).
I'm not sure if the pre-existing optimization to allow
StandardCharsets.charsets() unsynchronized access to internals
is really necessary (or even 100% correct), but by ensuring we
retrieve the Aliases and Classes instances in a synchronized block
we should be no worse off semantically here.
More information about the nio-dev