RFR: 8305811: (bf) Improve performance of CharBuffer::append(CharSequence[,int,int]) [v3]

Brian Burkhalter bpb at openjdk.org
Thu Apr 13 18:01:42 UTC 2023


On Thu, 13 Apr 2023 15:45:06 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Use the `getChars` method of `String`, `StringBuffer`, and `StringBuilder` to load the chars directly into the array of the heap buffer.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8305811: Cleanup to address reviewer comments

Output of one sample run of benchmark in commit b5925f86d8f52829f8410b881f306acc8d5d8065:

**Baseline**

Benchmark                                 Mode  Cnt        Score        Error  Units
CharBufferAppend.appendDirectToDirect    thrpt   10   129849.131 ±   4645.720  ops/s
CharBufferAppend.appendDirectToHeap      thrpt   10   390990.595 ±   8697.089  ops/s
CharBufferAppend.appendHeapToDirect      thrpt   10   154286.176 ±   4342.043  ops/s
CharBufferAppend.appendHeapToHeap        thrpt   10  1090783.500 ±   9991.163  ops/s
CharBufferAppend.appendString            thrpt   10  4488528.796 ±  37439.111  ops/s
CharBufferAppend.appendStringBuffer      thrpt   10  4277147.514 ±  98525.982  ops/s
CharBufferAppend.appendStringBuilder     thrpt   10  1177151.471 ±  32921.328  ops/s
CharBufferAppend.appendSubString         thrpt   10  2928829.174 ±  22081.457  ops/s
CharBufferAppend.appendSubStringBuffer   thrpt   10  2627515.567 ±  10252.383  ops/s
CharBufferAppend.appendSubStringBuilder  thrpt   10  2666802.455 ± 126736.359  ops/s


**This PR**

Benchmark                                 Mode  Cnt        Score        Error  Units
CharBufferAppend.appendDirectToDirect    thrpt   10  4551888.616 ± 206066.272  ops/s
CharBufferAppend.appendDirectToHeap      thrpt   10  2424227.065 ±  95839.467  ops/s
CharBufferAppend.appendHeapToDirect      thrpt   10  2409280.271 ±  59139.846  ops/s
CharBufferAppend.appendHeapToHeap        thrpt   10  3093823.928 ±  98373.516  ops/s
CharBufferAppend.appendString            thrpt   10  4439660.253 ± 179205.872  ops/s
CharBufferAppend.appendStringBuffer      thrpt   10  6453873.759 ± 197452.708  ops/s
CharBufferAppend.appendStringBuilder     thrpt   10  3835467.861 ±  31527.405  ops/s
CharBufferAppend.appendSubString         thrpt   10  2640762.394 ±  14132.136  ops/s
CharBufferAppend.appendSubStringBuffer   thrpt   10  2645231.945 ±  12584.049  ops/s
CharBufferAppend.appendSubStringBuilder  thrpt   10  8221813.914 ±  89518.341  ops/s

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

PR Comment: https://git.openjdk.org/jdk/pull/13415#issuecomment-1507391910


More information about the nio-dev mailing list