BenchmarkConfig class
Configuration for benchmark runs.
A benchmark run consists of:
- Warmup phase: Runs each variant warmupIterations times to allow JIT compilation and cache warming. Results are discarded.
- Sampling phase: Collects samples measurements, where each sample times iterations executions of the code under test.
Example:
// Custom configuration for a slow operation
final config = BenchmarkConfig(
iterations: 100, // Fewer iterations for slow code
samples: 20, // More samples for statistical confidence
warmupIterations: 50,
);
Constructors
- BenchmarkConfig({int iterations = 1000, int samples = 10, int warmupIterations = 500, bool randomizeOrder = true})
-
Creates a benchmark configuration.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- iterations → int
-
Number of iterations per sample.
final
- randomizeOrder → bool
-
Whether to randomize the order of variants between samples.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- samples → int
-
Number of samples to collect.
final
- warmupIterations → int
-
Number of warmup iterations before sampling begins.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- quick → const BenchmarkConfig
- Quick benchmark configuration for fast feedback.
- standard → const BenchmarkConfig
- Standard benchmark configuration (default).
- thorough → const BenchmarkConfig
- Thorough benchmark configuration for important decisions.