Skip to main content

Crate dev_bench

Crate dev_bench 

Source
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(|| {
        // code under measurement
        std::hint::black_box(40 + 2);
    });
}

let result = b.finish();
let threshold = Threshold::regression_pct(10.0);   // fail on +10%
let verdict = result.compare_against_baseline(None, threshold);

Structs§

Benchmark
A single benchmark run.
BenchmarkResult
The result of a finished benchmark.

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.