RFR: 8342540: InterfaceCalls micro-benchmark gives misleading results
Aleksey Shipilev
shade at openjdk.org
Fri Oct 18 14:08:49 UTC 2024
On Fri, 18 Oct 2024 11:53:06 GMT, Andrew Haley <aph at openjdk.org> wrote:
> `InterfaceCalls.java` makes highly predictable memory accesses, which leads to a gross time underestimate of the case where a megamorphic access is unpredictable.
>
> Here's one example, with and without randomization. The unpredictable megamorphic call takes more than 4* as long as the benchmark.
>
>
> Benchmark (randomized) Mode Cnt Score Error Units
> InterfaceCalls.test2ndInt3Types false avgt 4 5.013 ± 0.081 ns/op
> InterfaceCalls.test2ndInt3Types true avgt 4 23.421 ± 0.102 ns/op
> ```
>
> This patch adds the "randomized" parameter, which allows the measurement of predictable and unpredictable megamorphic calls.
Is there even a point to do non-randomized test then?
test/micro/org/openjdk/bench/vm/compiler/InterfaceCalls.java line 51:
> 49: // Whether to step iteratively through the list of interfaces, or
> 50: // to select one in an unpredictable way.
> 51: @Param({"false", "true"}) private boolean randomized;
Suggestion:
@Param({"false", "true"})
private boolean randomized;
-------------
PR Review: https://git.openjdk.org/jdk/pull/21581#pullrequestreview-2378163030
PR Review Comment: https://git.openjdk.org/jdk/pull/21581#discussion_r1806543858
More information about the hotspot-compiler-dev
mailing list