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

ExE Boss duke at openjdk.org
Thu Apr 13 20:09:35 UTC 2023


On Thu, 13 Apr 2023 18:01:40 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: Add microbenchmark

src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template line 316:

> 314: #if[rw]
> 315:         if (csq instanceof StringBuilder sb)
> 316:             return append(sb, start, end);

Maybe try re‑adding variants for `StringBuffer` and `String` here in order to avoid substring allocations, and see if `CharBufferAppend.appendSubString` and `CharBufferAppend.appendSubStringBuffer` performance improves?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13415#discussion_r1165973880


More information about the nio-dev mailing list