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

Alan Bateman alanb at openjdk.org
Fri Apr 14 15:59:37 UTC 2023


On Fri, 14 Apr 2023 15:45:54 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: Reorder instanceof checks

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

> 299:         if (csq instanceof String str) {
> 300:             str.getChars(start, end, hb, ix(pos));
> 301:         } else if (csq instanceof StringBuilder bld) {

I supposed we rename rename bld  and buf to "sb" so that the naming is consistent with CharBuffer cb, heap buffer hb, etc. No big deal of course but it was sb and seems to have got renamed.

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

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


More information about the nio-dev mailing list