RFR: 8311220: Optimization for StringLatin UpperLower

温绍锦 duke at openjdk.org
Mon Jul 3 09:24:55 UTC 2023


On Mon, 3 Jul 2023 09:20:04 GMT, Glavo <duke at openjdk.org> wrote:

>> String str0 = new String(new byte[]{-75}, StandardCharsets.ISO_8859_1);
>> String str1 = str0.toUpperCase();
>> 
>> str0.coder is LATIN1
>> str1.coder is UTF16
>
>> ```java
>> String str0 = new String(new byte[]{-75}, StandardCharsets.ISO_8859_1);
>> String str1 = str0.toUpperCase();
>> ```
>> 
>> str0.coder is LATIN1 str1.coder is UTF16
> 
> This happens only with `toUpperCase`, not with `toLowerCase`.

another example:


String str0 = new String(new byte[]{-1}, StandardCharsets.ISO_8859_1);
String str1 = str0.toUpperCase();


str0.coder is LATIN1
str1.coder is UTF16

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14751#discussion_r1250548264


More information about the core-libs-dev mailing list