JMH

You can use JmhModule to integrate JMH testing with Mill.

Example configuration:

build.mill
//| mvnDeps: ["com.lihaoyi::mill-contrib-jmh:$MILL_VERSION"]
package build

import mill._, scalalib._

import contrib.jmh.JmhModule

object foo extends ScalaModule with JmhModule {
  def scalaVersion = "2.13.8"
  def jmhCoreVersion = "1.35"
}

Here are some sample commands:

> mill foo.runJmh             # Runs all detected jmh benchmarks
> mill foo.listJmhBenchmarks  # List detected jmh benchmarks
> mill foo.runJmh -h          # List available arguments to runJmh
> mill foo.runJmh regexp      # Run all benchmarks matching `regexp`

For Scala JMH samples see sbt-jmh.