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

Alan Bateman alanb at openjdk.org
Sat Apr 22 13:32:00 UTC 2023


On Mon, 17 Apr 2023 17:42:27 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: Revert comments added in previous commit

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

> 2045:      */
> 2046:     public $Type$Buffer append(CharSequence csq, int start, int end) {
> 2047:         if (csq instanceof CharBuffer cb) {

This change means the code no longer checks there is sufficient space so IOBE is thrown instead of BufferedOverException when there is sufficient space. It's a reminder that we'll need to expand the tests in advance of, or as part of, any of optimisations in this area.

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

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


More information about the nio-dev mailing list