Search code examples
javajvm-hotspotjmh

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


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.


Solution

  • 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.