So I ran a JMH Benchmark over a few methods and got response like this:
I am not able to understand what exactly the Score and Error
values signify.
Is there some reference documentation available for the same?
JMH (Java Microbenchmark Harness) is a library for writing benchmarks on the JVM, and it was developed as part of the OpenJDK project. It is a Java harness for building, running, and analyzing benchmarks of performance and throughput in many units, written in Java and other languages targeting the JVM.
In JMH, "operation" is an abstract unit of work. See e.g. the sample result: Benchmark Mode Cnt Score Error Units MyBenchmark.testMethod avgt 5 5.068 ± 0.586 ns/op. Here, the performance is 5.068 nanoseconds per operation. Nominally, one operation is one @Benchmark invocation.
There are two ways to run the JMH benchmark, uses Maven or run it via a JMH Runner class directly. 3.1 Maven, package it as a JAR and run it via org. openjdk. jmh.
@Fork annotation, instructs how benchmark execution will happen the value parameter controls how many times the benchmark will be executed, and the warmup parameter controls how many times a benchmark will dry run before results are collected.
As an example, ss_stream
with parameters n=100000
took ca. 1,363 microseconds to run on average over 30 iterations (and was run a number of times in each of these iterations, depending on the length of each iteration).
Assuming that the results are normally distributed, for that sample size, one would expect that the "true" execution time for that method has a 99.9% probability to be somewhere between 1,362.752 - 126.340 microseconds and 1,362.752 + 126.340 microseconds, i.e. between ca. 1,236 and 1,489.
As far as I know, the main documentation is in the samples. The second one gives information about the various benchmark modes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With