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

ExE Boss duke at openjdk.org
Sat Apr 22 14:50:43 UTC 2023


On Thu, 20 Apr 2023 20:03:57 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> 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.

This is probably to avoid allocating the temporary `char[] buf` array when the session is known to be closed.

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

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


More information about the nio-dev mailing list