Fastpath for new String(bytes..) and String#getBytes(..) for ASCII + ISO-8859-1

Ulf Zibis Ulf.Zibis at gmx.de
Wed Jun 17 12:28:56 UTC 2009


Sherman,

thanks for your answer.

Do you have overseen, that String#getASCIIBytes(..) and 
String#getISO8859_1Bytes(..) was only mentioned as *alternative*?

As I agree, adding methods with specific encoding names to API is bad 
design, I would prefer method signatures like getBytes(byte[] buf, byte 
mask).
This additionally allows 6-bit ASCII de/encoding.
We could additionally provide static constants: MASK_ISO_8859_1, 
MASK_ASCII, MASK_ASCII_6BIT.

Imagine, you have very short Strings. Loading/instantiating charset + 
de/encoder instances (by name) takes more time than the de/encoding 
itself in current implementation. So there should be additional big 
performance gain e.g. for CORBA applications.

-Ulf


Am 17.06.2009 04:50, Xueming Shen schrieb:
> I would be very hesitated to add methods with specific encoding names, 
> even these encodings are
> VERY important, such as ASCII and ISO8859. Hack a fast path in the 
> implementation to boost the
> performance for some important encodings is something we want to do, 
> but add specific methods
> into the API is totally different thing.
>
> sherman
>
> Ulf Zibis wrote:
>> Hi Sherman, may be you are interested in this bug:
>>
>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6826329
>>
>> -Ulf
>>
>>
>
>




More information about the core-libs-dev mailing list