JUnitBenchmarks:

 

Code benchmarking in JUnit4

alpha
  • Records execution time average and standard deviation.
  • Garbage collector activity recording.
  • Per-benchmark JVM warm-up phase.
  • Per-run and historical chart generation.
  • Optional results persistence in the H2 SQL database (advanced querying, historical analysis).

JUnitBenchmarks will turn your JUnit4 tests into performance micro-benchmarks in a matter of a few simple annotations. It can also generate per-run and historical charts from the data it collects.

Motivation

Microbenchmarks and why we think they are useful and relevant (ehm, at least sometimes).

Build Integration

See how to integrate the project with popular build management systems: ANT and Maven.

Support

Give us some feedback on the JUnitBenchmarks discussion group.

Super-short teaser

    public class WhatsMyAverageRunningTime extends AbstractBenchmark {
      private final static Random rnd = new Random();
      
      @Test
      public void question() throws Exception {
        Thread.sleep(rnd.nextInt(100));
      }
    }

And the answer, after running in Eclipse:

JUnitBenchmarks output in Eclipse Console

(Yes, we know this one could be analytically determined :)