19 December 2010

Google Caliper

Google Caliper
Caliper is Google's open-source framework for writing, running and viewing the results of JavaMicrobenchmarks.

It is quite rough around the edges (June 2010), but we have already found it quite useful, and the API should be pretty stable.

The simplest complete Caliper benchmark looks like this:

public class MyBenchmark extends SimpleBenchmark {
     public void timeMyOperation(int reps) {
         for (int i = 0; i < reps; i++) {
             MyClass.myOperation();
         }
     }
}