Why is @GenerateMicroBenchmark missing in JMH and what is its replacement?
Asked Answered
G

1

5

I tried to create benchmarks with JMH and all tutorials i found refer to @GenerateMicroBenchmark.

But i cannot find it in jmh-core:1.11.3.

If it was removed, what is its replacement and what is the idiomatic way to create benchmarks without that annotation.

Gassaway answered 17/1, 2016 at 13:22 Comment(0)
C
10

Following the documentation here http://openjdk.java.net/projects/code-tools/jmh/

The first example has

@Benchmark
public void wellHelloThere() {
    // this method was intentionally left blank.
}

It appears the annotation you mention was renamed 2-3 years ago.

Cogency answered 17/1, 2016 at 15:28 Comment(2)
It seems as there are a lot of outdated tutorials out there. The examples are hidden at the end of the page you mentionedGassaway
The tutorials in github.com/openjdk/jmh/tree/master/jmh-samples are always good, since they're maintained alongside the project code.Maniacal

© 2022 - 2024 — McMap. All rights reserved.