RFR: 8343933: Add a MemorySegment::fill benchmark with varying sizes [v2]
Francesco Nigro
duke at openjdk.org
Mon Nov 11 15:00:31 UTC 2024
On Mon, 11 Nov 2024 14:50:57 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR proposes to add a new `MemorySegment::fill" benchmark where the byte size of the segments varies.
>
> Per Minborg has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>
> - Add mixed test
> - Merge branch 'master' into ms-fill-bench-sizes
> - Use static arrays
> - Revert changes from other branch
> - Add benchmark
> - Add benchmarks
test/micro/org/openjdk/bench/java/lang/foreign/SegmentBulkRandomFill.java line 169:
> 167: public void mixedSegmentFillUnsafe() {
> 168: for (int i = 0; i < INSTANCES; i++) {
> 169: MIXED_SEGMENTS[i].fill((byte) 0);
loop unrolling can defeat a bit the purpose of messing up with branch misprediction here so...one solution is to avoid loop unrolling OR
create a
@CompilerControl(DONTINLINE)
static void fillSegment(MemorySegment ms, byte value) {
memorySegment.fill(value);
}
which makes sure (at the cost of a very predictable call to the `fillSegment` method) that:
- the inlining depth of fill is controlled and not dependent by the depth of the JMH infra caller
- the call site for fill is always the same (in term of the address in the compiled blob)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22010#discussion_r1836806492
More information about the core-libs-dev
mailing list