Expand description
§dev-bench
Performance measurement and regression detection for Rust. Part of
the dev-* verification suite.
dev-bench answers the question: did this change make the code
faster, slower, or stay the same? It compares current measurements
against a stored baseline and emits verdicts via dev-report.
§Quick example
use dev_bench::{Benchmark, Threshold};
let mut b = Benchmark::new("parse_query");
for _ in 0..1000 {
b.iter(|| {
std::hint::black_box(40 + 2);
});
}
let result = b.finish();
let threshold = Threshold::regression_pct(10.0); // fail on +10%
let _check = result.compare_against_baseline(None, threshold);§What’s measured
Per-sample wall-clock duration captured via Instant::now(). From
the samples, dev-bench reports mean, p50, p99, cv, and a
derived ops_per_sec throughput. See BenchmarkResult.
§Features
alloc-tracking(opt-in): measures allocation count and bytes alongside time, usingdhat. See theallocmodule.
Re-exports§
pub use baseline::Baseline;pub use baseline::BaselineStore;pub use baseline::JsonFileBaselineStore;
Modules§
- alloc
alloc-tracking - Allocation tracking. Available with the
alloc-trackingfeature. - baseline
- Baseline storage for benchmark results.
Structs§
- Bench
Producer - Producer wrapper that runs a benchmark and emits a single-check
ReportviaProducer::produce. - Benchmark
- A single benchmark run.
- Benchmark
Result - The result of a finished benchmark.
- Compare
Options - Options for
BenchmarkResult::compare_with_options.
Enums§
- Threshold
- A threshold defining how much slower-than-baseline is acceptable.
Traits§
- Bench
- A trait for any object that can run a benchmark and produce a result.