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

Tom Hawtin Thomas.Hawtin at Sun.COM
Wed Jun 17 13:06:47 UTC 2009

Xueming Shen wrote:
> 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.

In my opinion, it makes more sense to add methods to Charset than to 
String - the latter is easily the more fundamental type. Indeed there 
are already convenience methods encode/decode for ByteBuffer. Trusted 
Charset implementations could override and use SharedSecrets or rely 
upon inlining for fast access to String character data.


More information about the core-libs-dev mailing list