RFR: 8336831: Optimize StringConcatHelper.simpleConcat [v5]
Chen Liang
liach at openjdk.org
Sat Jul 20 13:21:32 UTC 2024
On Sat, 20 Jul 2024 13:16:16 GMT, Brett Okken <duke at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/StringConcatHelper.java line 387:
>>
>>> 385: byte[] buf = newArray(newLength);
>>> 386: s1.getBytes(buf, 0, coder);
>>> 387: s2.getBytes(buf, s1.length(), coder);
>>
>> Does s1 length need to be shifted by coder for dstBegin?
>
> Nope - I see the index is char based
>
> https://github.com/openjdk/jdk/blob/69901157e4dae9018abd727956f60fd11b8fa252/src/java.base/share/classes/java/lang/String.java#L4821C15-L4821C23
No; in StringUTF16 we abstract away array indices with char index, like in putChar.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20253#discussion_r1685433034
More information about the core-libs-dev
mailing list