RFR: 8306374: (bf) Improve performance of DirectCharBuffer::append(CharSequence[,int,int]) [v5]

Alan Bateman alanb at openjdk.org
Wed Apr 26 14:20:54 UTC 2023


On Tue, 25 Apr 2023 23:12:24 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Use `getChars()` to copy characters to an intermediate local `char[]` array and then `putArray()` to copy the chars into the buffer itself.
>
> Brian Burkhalter 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 six additional commits since the last revision:
> 
>  - 8306374: Remove checkSession() from appendChars(); augment test
>  - Merge
>  - 8306374: Replace checkFromIndexSize() with checkFromToIndex()
>  - 8306374: Remove superfluous csq == null check
>  - 8306374: Add explicit bounds check; allocate less memory if possible
>  - 8306374: (bf) Improve performance of DirectCharBuffer::append(CharSequence[,int,int])

Marked as reviewed by alanb (Reviewer).

src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template line 451:

> 449:     private static final int APPEND_BUF_SIZE = 1024;
> 450: 
> 451:     private $Type$Buffer appendChars(CharSequence csq, int start, int end) {

I assume we don't need to generate for read-only char buffers.

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

PR Review: https://git.openjdk.org/jdk/pull/13522#pullrequestreview-1402094163
PR Review Comment: https://git.openjdk.org/jdk/pull/13522#discussion_r1177942413


More information about the nio-dev mailing list