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

Brian Burkhalter bpb at openjdk.org
Wed Apr 19 16:46:48 UTC 2023


On Wed, 19 Apr 2023 16:34:31 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8306374: Add explicit bounds check; allocate less memory if possible
>
> src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template line 456:
> 
>> 454:         int length = end - start;
>> 455:         Objects.checkFromIndexSize(start, length,
>> 456:                                    csq == null ? 0 : csq.length());
> 
> Suggestion:
> 
>         Objects.checkFromIndexSize(start, length, csq.length());
> 
> Aren't the calls to `appendChars` already guarded by `instanceof` checks, which produces `false` for `null`?

Oh, I think you are correct. Removed in 52c9458.

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

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


More information about the nio-dev mailing list