Constants for standard charsets -- CR #4884238

Mike Duigou mike.duigou at oracle.com
Tue Apr 12 21:25:10 UTC 2011


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.

> 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.

Mike


More information about the core-libs-dev mailing list