Changelog

New updates and improvements released to Codspeed.

May 06, 2026

Java

Java Support

Java Support

You can now use CodSpeed to benchmark Java codebases thanks to our new integration with JMH.

JMH is the de-facto standard for JVM microbenchmarking, designed by the OpenJDK team to deal with the complexities of benchmarking on the JVM. What it doesn't do is keep things stable across CI runs or tell you when a pull request just regressed a hot path. That's where CodSpeed comes into play.

Quick Start

The integration works with both Maven and Gradle, see the documentation for details on how to set it up.

Write benchmarks with the standard JMH API:

import org.openjdk.jmh.annotations.Benchmark;

public class FibBenchmark {
  static int fib(int n) {
    return n < 2 ? n : fib(n - 1) + fib(n - 2);
  }

  @Benchmark
  public int benchFib10() {
    return fib(10);
  }
}

Then run them in CI with the CodSpeed Action. For now, only Walltime mode is supported.

- name: Run the benchmarks
  uses: CodSpeedHQ/action@v4
  with:
    mode: walltime
    run: java -jar bench.jar

Benchmarks also run locally using the CodSpeed CLI:

codspeed run --mode walltime -- java -jar bench.jar

For more information, check out the Java documentation and the JMH Benchmark Guide.

We handle performance, so you can focus on shipping.

Talk to our team about deployment, security, and scale; or start building today.