Skip to main content

Crate philiprehberger_bench_utils

Crate philiprehberger_bench_utils 

Source
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§

BenchGroup
A group of benchmarks that can be run and compared together.
BenchResult
Result of a benchmark run, containing timing samples and statistical methods.
CompareResult
Result of comparing two benchmarks.
RegressionCheck
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 iterations invocations of f.
bench_compare
Compares two closures by benchmarking each for iterations runs.
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.