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

Ulf Zibis Ulf.Zibis at gmx.de
Thu Apr 28 20:55:41 UTC 2011


Am 28.04.2011 21:56, schrieb Xueming Shen:
> That said, you do have the point, we should do better even in
> malformed case, ...
Yes, that's what I wanted to point on.
But I thought, you could go 1 step further, declaring bb as member of UTF_8.Decoder. Then it should 
be guaranteed, the a decoder is in use of only one thread at same time. Don't know if that is the 
case for the typical use cases?

In http://cr.openjdk.java.net/~mduigou/4884238/2/webrev/ I've seen the change to use a constant 
Charset object instead of a constant charset name on some method calls. From your benchmark it 
seems, using constant charset names has some little performance gain (0..25 %) , so I don't see the 
benefit of the changes from 4884238 in contrary direction.

-Ulf




More information about the core-libs-dev mailing list