RFR: 7903367: JMH: Add JMHSample_39_MemoryAccess [v2]

Aleksey Shipilev shade at openjdk.org
Wed Oct 19 14:12:21 UTC 2022


On Mon, 17 Oct 2022 19:18:21 GMT, Michael Mirwaldt <duke at openjdk.org> wrote:

>> I propose this sample because overlooking the memory layout of e.g. ArrayLists can be a pitfall for benchmarks.
>> This new sample makes users of JMH aware of this problem. It teaches them how to use JMH right.
>> What do you think?
>
> Michael Mirwaldt has updated the pull request incrementally with one additional commit since the last revision:
> 
>   improved by proposals from first review

All right, I am willing to accept this. But going forward, I would need to create a special chapter for these tests, which would describe common effects/pitfalls in benchmarks.

jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_39_MemoryAccess.java line 47:

> 45: @OutputTimeUnit(TimeUnit.MILLISECONDS)
> 46: @Warmup(iterations = 5, time = 1)
> 47: @Measurement(iterations = 5, time = 1)

add `timeUnit = TimeUnit.SECONDS` here, please.

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

Marked as reviewed by shade (Committer).

PR: https://git.openjdk.org/jmh/pull/85


More information about the jmh-dev mailing list