Harness benchmarks for Java

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targeting the JVM.


Add the maven coordinates to your Maven pom.xml


You can clone the source Repository http://hg.openjdk.java.net/code-tools/jmh/

hg clone http://hg.openjdk.java.net/code-tools/jmh

Benchmark parts of your code by using annotations

public void processPayment(MoneyTransaction trx){

See also http://www.oracle.com/technetwork/articles/java/architect-benchmarking-2266277.html