RFR: 8311178: JMH tests don't scale well when sharing output buffers
Swati Sharma
duke at openjdk.org
Tue Jul 4 04:19:03 UTC 2023
On Sat, 1 Jul 2023 19:05:23 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:
>> The below benchmark files have scaling issues due to cache contention and leads to poor scaling when run on multiple threads. The patch sets the scope from benchmark level to thread level to fix the issue:
>> - org/openjdk/bench/java/io/DataOutputStreamTest.java
>> - org/openjdk/bench/java/lang/ArrayCopyObject.java
>> - org/openjdk/bench/java/lang/ArrayFiddle.java
>> - org/openjdk/bench/java/time/format/DateTimeFormatterBench.java
>> - org/openjdk/bench/jdk/incubator/vector/IndexInRangeBenchmark.java
>> - org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java
>> - org/openjdk/bench/jdk/incubator/vector/StoreMaskedBenchmark.java
>> - org/openjdk/bench/jdk/incubator/vector/StoreMaskedIOOBEBenchmark.java
>> - org/openjdk/bench/vm/compiler/ArrayFill.java
>> - org/openjdk/bench/vm/compiler/IndexVector.java
>>
>> Also removing the static scope for variables in org/openjdk/bench/jdk/incubator/vector/VectorFPtoIntCastOperations.java for better scaling.
>>
>> Please review and share your feedback.
>>
>> Thanks,
>> Swati
>
> test/micro/org/openjdk/bench/java/lang/ArrayCopyObject.java line 64:
>
>> 62: }
>> 63:
>> 64: @State(Scope.Thread)
>
> Are you sure it makes sense as in `main()` method we set `fork(1)` so there's only one thread running the benchmark?
AFAIK fork value specifies number of times harness should [fork](https://javadoc.io/doc/org.openjdk.jmh/jmh-core/0.6/org/openjdk/jmh/annotations/Fork.html). Also the change is setting scope to thread level not controlling the number of threads.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14746#discussion_r1251459004
More information about the hotspot-compiler-dev
mailing list