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.

83 questions
18
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
  • 44,714
  • 32
  • 161
  • 320
16
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
  • 44,714
  • 32
  • 161
  • 320
14
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
  • 13,982
  • 13
  • 79
  • 165
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
  • 413
  • 2
  • 8
  • 14
9
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
  • 818
  • 3
  • 17
  • 33
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,575
  • 2
  • 26
  • 42
7
votes
3 answers

Do Go testing.B benchmarks prevent unwanted optimizations?

I've recently started learning Go and I'm trying to implement a map that can be used concurrently by multiple groutines. I want to be able to compare my implementation to a simple sync.Mutex-protected map, or to something like this:…
Elsinor
  • 190
  • 8
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,611
  • 6
  • 47
  • 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
  • 39,182
  • 5
  • 68
  • 95
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
  • 295,120
  • 86
  • 501
  • 681
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
  • 44,714
  • 32
  • 161
  • 320
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,719
  • 1
  • 40
  • 56
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
  • 18,671
  • 14
  • 48
  • 59
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,722
  • 2
  • 23
  • 25
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,751
  • 4
  • 49
  • 59
1
2 3 4 5 6