On Thu, 13 Nov 2025 18:42:36 GMT, Per Minborg <[email protected]> wrote:
>> This PR proposes to consolidate and standardize the benchmarks related to
>> the bulk operations for memory segments.
>>
>> All the benchmarks will now run with
>> (heap|native)x(aligned|unaligned)x(intint|intlong|longlong) combinations.
>>
>> It should be noted that with this change, the running time for the
>> benchmarks would increase significantly.
>
> Per Minborg has updated the pull request incrementally with three additional
> commits since the last revision:
>
> - Remove lingering comment
> - Refactor and use long arrays
> - Remove BulkOps
test/micro/org/openjdk/bench/java/lang/foreign/SegmentBulkCopy.java line 122:
> 120: var s = MemorySegment.ofArray(baseArray);
> 121: srcSegment = Arena.ofAuto().allocateFrom(JAVA_LONG,
> s, JAVA_LONG, 0L, baseArray.length);
> 122: dstSegment = Arena.ofAuto().allocateFrom(JAVA_LONG,
> s, JAVA_LONG, 0L, baseArray.length);
You can use the other overload that accepts a long[]:
Suggestion:
srcSegment = Arena.ofAuto().allocateFrom(JAVA_LONG,
baseArray);
dstSegment = Arena.ofAuto().allocateFrom(JAVA_LONG,
baseArray);
test/micro/org/openjdk/bench/java/lang/foreign/SegmentBulkFill.java line 114:
> 112: segment = switch (SegmentType.valueOf(segmentType)) {
> 113: case HEAP -> heapSegment;
> 114: case NATIVE -> Arena.ofAuto().allocateFrom(JAVA_LONG,
> heapSegment, JAVA_LONG, 0L, baseArray.length);
Suggestion:
case NATIVE -> Arena.ofAuto().allocateFrom(JAVA_LONG,
baseArray);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28260#discussion_r2524593943
PR Review Comment: https://git.openjdk.org/jdk/pull/28260#discussion_r2524598903