javatestingbenchmarkingjmh

JMH Benchmark first approach


I am approaching for the first time the benchmark tests for my thesis work and I'm studying JMH. I'm using the https://github.com/spring-petclinic/spring-petclinic-rest code to do some tests. After initializing JMH I obtained the class:

import org.openjdk.jmh.annotations.Benchmark;

public class MyBenchmark {

    @Benchmark
    public void testMethod() {
        // This is a demo/sample template for building your JMH benchmarks. Edit as needed.
        // Put your benchmark code here.

    }

}

If I run mvn clean package it generates the target/spring-petclinic-rest-2.6.2-perf-tests.jar file and if I do java -jar target/spring-petclinic-rest-2.6.2-perf-tests.jar I obtain some results.

My question is, with this simple MyBenchmark class with the empty testMethod method, what is this benchmark test applied to? What code did he test?

Thank you in advance.


Solution

  • I think it tested nothing particular as the benchmarking method it empty. The numbers you are seeing are the the costs of the method invocation.