Codereview request: CR 7040220 java/char_encodin Optimize UTF-8 charset for String.getBytes()/toCharArray()

Ulf Zibis Ulf.Zibis at gmx.de
Sat Apr 30 17:24:38 UTC 2011


Am 29.04.2011 02:11, schrieb Xueming Shen:
> On 04-28-2011 3:46 PM, Ulf Zibis wrote:
>>
>>> It's safe to say that java.nio.cs.StandardCharset is not for String.getBytes()/toCharArray()
>>> only, so the fact that "cs" variant of String.getBytes()/toCharArray() is "slower" than its "csn"
>>> variant arguably might not be a very strong/supportive material for that discussion:-)
>> So what prevents us from the same caching optimization in ZipCoder etc. class ?
>>
>
> What do you want to cache in ZipCoder? Each ZipFile object holds one ZipCoder object and
> uses it for its coding need through its lifetime. And ZipCoder does "remember" its de/encoder.
I see! Yes, caching it for consecutive ZipFiles would be too much overhead compared to the "heavy" 
other work of each ZipFile.

Thanks for the discussion,

-Ulf




More information about the core-libs-dev mailing list