RFR: Samples/jmh sample 39 memory access [v2]
Michael Mirwaldt
duke at openjdk.org
Mon Oct 17 19:18:21 UTC 2022
On Mon, 17 Oct 2022 07:56:42 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Michael Mirwaldt has updated the pull request incrementally with one additional commit since the last revision:
>>
>> improved by proposals from first review
>
> Quick review...
Thanks so far for your suggestions, @shipilev.
> jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_39_MemoryAccess.java line 64:
>
>> 62: *
>> 63: * Benchmark Mode Cnt Score Error Units
>> 64: * JMHSample_39_MemoryAccess.sumArray avgt 25 5.117 ± 0.039 ns/op
>
> 5 ns to sum 1M elements seems way too low.
I increased N from 1_000_000 to 100_000_000, changed the output time unit from nano to millis and updated the benchmarks result shown in the comment.
> jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_39_MemoryAccess.java line 96:
>
>> 94: long sum = 0;
>> 95: for (int i = 0; i < N; i++) {
>> 96: sum = intList.get(i);
>
> This needs to be `+=`.
Done
-------------
PR: https://git.openjdk.org/jmh/pull/85
More information about the jmh-dev
mailing list