RFR: 8305811: (bf) Improve performance of CharBuffer::append(CharSequence[,int,int]) [v4]
Brian Burkhalter
bpb at openjdk.org
Fri Apr 14 00:49:46 UTC 2023
On Fri, 14 Apr 2023 00:41:59 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> I'll check it out.
>
> The commit bf403f90bce165ad71e45a0372d22be4165c3e61 adds the use of `getChars()` when appending a subsequence of a `String` or `StringBuffer`. Avoiding substring allocation in fact improves performance as shown in these updated results:
>
> Benchmark Mode Cnt Score Error Units
> CharBufferAppend.appendDirectToDirect thrpt 10 4719216.266 ± 227330.627 ops/s
> CharBufferAppend.appendDirectToHeap thrpt 10 2102880.055 ± 55054.002 ops/s
> CharBufferAppend.appendHeapToDirect thrpt 10 2328149.744 ± 110434.431 ops/s
> CharBufferAppend.appendHeapToHeap thrpt 10 3227172.246 ± 79850.461 ops/s
> CharBufferAppend.appendString thrpt 10 4418599.392 ± 51612.735 ops/s
> CharBufferAppend.appendStringBuffer thrpt 10 4362670.418 ± 101017.472 ops/s
> CharBufferAppend.appendStringBuilder thrpt 10 3856127.917 ± 110625.008 ops/s
> CharBufferAppend.appendSubString thrpt 10 7913540.253 ± 84487.457 ops/s
> CharBufferAppend.appendSubStringBuffer thrpt 10 8284545.161 ± 102884.827 ops/s
> CharBufferAppend.appendSubStringBuilder thrpt 10 8258542.262 ± 94236.638 ops/s```
The commit message of https://github.com/openjdk/jdk/commit/bf403f90bce165ad71e45a0372d22be4165c3e61 should have been "8305811: Use getChars() when appending a partial String or StringBuffer."
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13415#discussion_r1166162487
More information about the nio-dev
mailing list