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

Alan Bateman alanb at openjdk.org
Thu Apr 20 20:06:46 UTC 2023


On Wed, 19 Apr 2023 21:59:26 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 incrementally with one additional commit since the last revision:
> 
>   8306374: Replace checkFromIndexSize() with checkFromToIndex()

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

> 450: 
> 451:     private $Type$Buffer appendChars(CharSequence csq, int start, int end) {
> 452:         checkSession();

This template is for direct buffers so I'm not 100% sure that checkSession is needed here. If the session is closed then SMA.copyMemory used in putArray will throw.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13522#discussion_r1173036535


More information about the nio-dev mailing list