RFR: 8254082: AbstractStringBuilder.insert(int dstOffset, CharSequence s, int start, int end) is missing fast-path for String [v3]
Сергей Цыпанов
github.com+10835776+stsypanov at openjdk.java.net
Sat Nov 28 15:06:59 UTC 2020
On Fri, 27 Nov 2020 21:04:59 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>>
>> - 8254082: Consolidate putStringAt() methods
>> - Merge branch 'master' into asb
>> - Merge branch 'master' into asb
>> - 8254082: Add fast-path for String into AbstractStringBuilder.insert(int, CharSequence, int, int)
>
> src/java.base/share/classes/java/lang/String.java line 3620:
>
>> 3618: void getBytes(byte[] dst, int srcPos, int dstBegin, byte coder, int length) {
>> 3619: if (coder() == coder) {
>> 3620: System.arraycopy(value, srcPos, dst, dstBegin << coder, length);
>
> Would it be more consistent and easier to follow if we took the length in chars, not in bytes, and adjusted it here with the coder? JITs should do short work of the need to adjust by calling `length()` in `getBytes(byte[], int, byte)` above.
>
> If we're worried about unexpected performance effects we can separate these two `getBytes` methods to independent methods rather than delegate from one to the other.
Done!
-------------
PR: https://git.openjdk.java.net/jdk/pull/402
More information about the core-libs-dev
mailing list