Questions tagged [caliper]

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

See the Caliper project site, and online result viewer.

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();
    }
  }
}

Very short tutorial examples.

More introductory examples.

78 questions
17
votes
2 answers

How to measure file read speed without caching?

My java program spends most time by reading some files and I want to optimize it, e.g., by using concurrency, prefetching, memory mapped files, or whatever. Optimizing without benchmarking is a non-sense, so I benchmark. However, during the…
maaartinus
  • 40,991
  • 25
  • 130
  • 292
15
votes
1 answer

Performance of Guava's ImmutableSet.contains

Guava's ImmutableSet seems to perform quite poorly in my benchmark concerning contains. For some sizes it gets even much slower than List: size benchmark ns linear runtime 100000 ListContains 110279.54 == 100000 …
maaartinus
  • 40,991
  • 25
  • 130
  • 292
13
votes
2 answers

caliper error: CICompilerCount of 1 is invalid; must be at least 2

i have a caliper benchmark (1.0-beta-2): import com.google.caliper.Benchmark; import com.google.caliper.runner.CaliperMain; public class MyBenchmark { @Benchmark public int a(int rep) { return 0; } public static void…
piotrek
  • 12,111
  • 8
  • 63
  • 144
11
votes
2 answers

Google Caliper: Trouble getting started (Java Benchmarking)

I am trying to use Google Caliper to benchmark some simple code. I am using the examples from their websites. Here's what I've done so far: Downloaded the Caliper JAR and added it to my Netbeans project After having difficulties, I downloaded…
user2341412
  • 393
  • 1
  • 7
  • 13
9
votes
1 answer

Estimating actual (not theoretic) runtime complexity of an implementation

Anyone in computer science will know that HeapSort is O(n log n) worst case in theory, while QuickSort is O(n^2) worst case. However, in practice, a well implemented QuickSort (with good heuristics) will outperform HeapSort on every single data set.…
Erich Schubert
  • 8,318
  • 2
  • 22
  • 41
8
votes
3 answers

How to use Caliper for benchmarking?

I am trying to figure out how to use Caliper to do benchmark testing in Eclipse and I am getting nowhere. I tried following the 26 minute tutorial found here: https://code.google.com/p/caliper/ but I get lost quickly. I have downloaded the Caliper…
LooMeenin
  • 768
  • 3
  • 13
  • 32
7
votes
2 answers

Why is the short primitive type significantly slower than long or int?

I tried to optimize the RAM usage of a Android game by changing int primitives to shorts. Before I did this I was interested in the performance of the primitive types in Java. So I created this little test benchmark using the caliper library. public…
Rolf ツ
  • 8,197
  • 5
  • 44
  • 72
6
votes
1 answer

Running caliper from eclipse in maven's test scope

I have a Java project in Eclipse, with JUnit tests in my src/test directory. I've also added a class to my tests with Caliper microbenchmarks, and I'd like to be able to run these tests from within Eclipse. As the Caliper code is test code, I've…
Andrew Aylett
  • 36,202
  • 4
  • 63
  • 92
5
votes
2 answers

How can I name the runs sent online with Caliper?

I have a benchmark that requires multiple runs to compare the results, since it needs to be compiled with different compilers and compile parameters. When I execute it, the runs are sent online with simple designators: A, B, C, etc. I'd like to…
Daniel C. Sobral
  • 284,820
  • 82
  • 479
  • 670
5
votes
2 answers

Strange performance drop of JDK8 LocalDate.toEpochDay

I was curious if we finally get a fast datetime library with JDK8. Nearly all LocalDate computations use toEpochDay so I looked at the source and the large number of divisions and branches made me curious if I could do better. I eliminated some…
maaartinus
  • 40,991
  • 25
  • 130
  • 292
5
votes
1 answer

Defining a gradle task to run caliper microbenchmark

This is probably more a Gradle question than a Caliper question, but I am still rather new to Gradle. I am interested in providing a task in my build that can run some benchmarks using Caliper. I have already added Caliper to my testCompile…
Kevin Welker
  • 7,211
  • 1
  • 33
  • 53
4
votes
1 answer

Junit setup with caliper

I am trying to wrap the caliper code in junit so the performance tests run as part of my unit tests. It seems to work - the caliper test actually runs, but it doesn't exit successfully. What's the proper way to set this stuff up? import static…
naumcho
  • 15,733
  • 14
  • 41
  • 54
4
votes
3 answers

Automatic Runtime Performance Regression Test in Java

I'm looking for ways to detect changes in runtime performance of my code in an automatic way. This would act in a similar way that JUnit does, but instead of testing the code's functionality it would test for sudden changes in speed. As far as I…
lessthanoptimal
  • 2,477
  • 2
  • 21
  • 21
4
votes
1 answer

Caliper: How to run multiple benchmarks?

I have written a few benchmarks using Caliper. How can I run multiple benchmarks at once? I currently have many classes that extend SimpleBenchmark and have a few timeXXX methods each. Is it possible to run these all at the same…
NateS
  • 5,747
  • 4
  • 46
  • 53
4
votes
1 answer

How do I run Guava's benchmark suite?

Guava has a guava-tests subdirectory that contains a directory subtree called benchmark. It appears that executing mvn test (or mvn install) runs the full suite of unit tests in the test subtree, but nothing is run in the benchmarks suite. My…
DIMMSum
  • 1,434
  • 1
  • 17
  • 38
1
2 3 4 5 6