Rules
- Benchmark classes must have a no-arg public constructor.
- Benchmark methods must be public.
- Benchmark methods must not take arguments.
- Benchmark methods can return values.
Annotations:
@Bench
Each benchmark methods must be annotated with the @Bench annotation.
Each method which has this annotation or one of its overridden method
of super class contains this annotation is considered a benchmark method
of the class.
The @Bench annotation also allows to specify certain parameters for the benchmark.
If some option is not set, the option's value is taken from the overridden method of
the super-class or if the method is not an overriding method, the default
value for the option is chosen.
Parameters:
- minRunCount: Minimum number of runs that are performed for benchmarking the method.
- maxRunCount: Maximum number of runs that are performed for benchmarking the method.
- minSampleCount: Minimum number of valid samples that are needed.
- maxDeviation: Maximum deviation from the minimal time allowed to consider a sample valid.
- divisor: Benchmark value divisor. The measured time is divided by this value.
- targetTimeNs: Target time for a single run of the benchmark.
@SingleRun
If a benchmark method gets annotated with the @SingleRun annotation,
the benchmark will be invoked only once during a benchmark run instead
of calculating the iteration count based on the target time.
If you use this annotation you must ensure yourself that the benchmark runs
a meaningful amouth of time.
@Group
The @Group annotation allows the benchmark class to be associated to
a certain benchmark group. The group is identified by the string given
to the annotation.