Enhance footprint for array initialization

Ulf Zibis Ulf.Zibis at gmx.de
Thu Sep 4 03:49:39 PDT 2008



Am 04.09.2008 12:08, Ulf Zibis schrieb:
> Am 03.09.2008 18:01, Tom Rodriguez schrieb:
>> There's an old trick for making more compact array initialization by 
>> using Strings as data containers.  Basically you encode your real 
>> data as a String and then at init time you get the char[] data out 
>> and transform it into whatever primitive array type you actually 
>> want.  It's a slightly dubious solution and I'd be surprised if 
>> anyone was still using it.
> Surprise, yes, most of the converters and coders in sun.io and 
> sun.nio.cs package use this technique. Example for decoding java chars 
> to byte data (simplified):
>
> String charToByteTable = { "\u0000\u0001\u0002 ..... "}
> ...
> byte outByte = (byte)charToByteTable.charAt(inChar);
>
>>
>> Is there any reason the initialization code in charset.jar couldn't 
>> just be written to be more efficient?
> This sentence I don't understand grammatically. Sorry, I'm no English 
> native speaker. Can you please write it in other words?
>
> Thanks for you effort,
>
> Ulf
>
>
>




More information about the hotspot-dev mailing list