Expand description
Micro-benchmarking utilities with statistical analysis, comparison, and regression detection.
Provides simple functions for measuring closure performance, comparing implementations, detecting regressions, and calculating throughput — all with zero dependencies.
§Quick start
use philiprehberger_bench_utils::{bench, black_box};
let result = bench("sum", 100, || {
let _sum: u64 = black_box((0..1000).sum());
});
println!("{}", result.summary());Structs§
- Bench
Group - A group of benchmarks that can be run and compared together.
- Bench
Result - Result of a benchmark run, containing timing samples and statistical methods.
- Compare
Result - Result of comparing two benchmarks.
- Regression
Check - Result of a regression check between a baseline and current benchmark.
- Throughput
- Throughput metrics for a benchmark.
Functions§
- bench
- Runs a benchmark, measuring each of
iterationsinvocations off. - bench_
compare - Compares two closures by benchmarking each for
iterationsruns. - bench_
with_ warmup - Runs a benchmark with warmup iterations that are not measured.
- black_
box - Prevents the compiler from optimizing away a value.
- check_
regression - Checks whether the current benchmark shows a regression compared to a baseline.
- throughput
- Calculates throughput metrics given a benchmark result and bytes per operation.