RFR: 8338967: Improve performance for MemorySegment::fill [v6]
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Aug 28 10:35:21 UTC 2024
On Wed, 28 Aug 2024 10:30:26 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Switch to bit checking instead of switch statement
>
> test/micro/org/openjdk/bench/java/lang/foreign/TestFill.java line 87:
>
>> 85: public void buffer_fill() {
>> 86: // Hopefully, the creation of the intermediate array will be optimized away.
>> 87: buffer.clear().put(new byte[ELEM_SIZE]);
>
> I think this should use an "absolute" put with explicit offset, so that you can avoid the clear? Otherwise it's not apple to apple...
in general though, ByteBuffer doesn't have a "fill" operation. What you are testing here is fill vs. copy, which is not really apple to apple. I think it's probably better to leave BB alone here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20712#discussion_r1734418264
More information about the core-libs-dev
mailing list