Am 12.04.2011 23:25, schrieb Mike Duigou:
On Apr 12 2011, at 12:10 , Ulf Zibis wrote:
Am 12.04.2011 20:27, schrieb Mike Duigou:
This change has been previously proposed but the constants were to be defined
in Charset which was deemed to have too high a static initialization cost.
Using a separate class, Charsets, means that the cost for initialization is
only borne by those who use the class--there's virtually no incremental cost to
platform initialization.
I can't agree with that, because you statically invoke e.g.
Charset.forName("US-ASCII"), which causes the expensive initialization of the
Charset class.
It's expected that by the time Charsets is referenced that Charset will already
be initialized. Charset is initialized during the setup of
System.out/System.err or earlier.
Yes, and I think, initializing those 6 simple charsets is nothing against initializing Charset
class, and even less after integrating ***Bug 100098*
<https://bugs.openjdk.java.net/show_bug.cgi?id=100098> - Make sun.nio.cs.* charset objects
light-weight .**
Please note my long waiting patches:
Bug 100091 - No system start for file.encoding=x-SJIS_0213
Bug 100092 - Speed-up FastCharsetProvider
Bug 100095 - Avoid 2-step lookup in sun.nio.cs charset providers
Bug 100098 - Make sun.nio.cs.* charset objects light-weight
Unfortunately I don't know anything about the status of these issues.
It's a pity. Lookup and initializing charsets could be much faster.
-Ulf