Skip to content

SYSTEM Cited by 1 source

criterion (Rust)

criterion (crates.io/crates/criterion) is the de-facto Rust statistical benchmarking crate. It measures isolated per-function runtime down to the nanosecond by aggregating many repeated executions, builds a statistical model around the timings, and tracks regression / improvement across runs.

Key properties

  • Nanosecond-resolution timings.
  • Statistical summaries (mean, median, outliers, confidence intervals) — not a single point estimate.
  • Regression tracking over time — changes in a function's performance are surfaced against a baseline, making commit-to-commit perf wins / regressions obvious.
  • No code instrumentation required beyond the #[bench]- style test harness.

Role in the wiki

The canonical wiki instance is Cloudflare's pingora-origin team using criterion to benchmark successive implementations of clear_internal_headers (loop → HashMapBTreeSet/FST → regex → radix_trietrie-hard) and pick the one that won — 3.65 µs → 0.93 µs. Critically the criterion microbench predictions matched production stack-trace sampling within a fraction of a percent, validating criterion as a trustworthy decision substrate for Cloudflare's hot-path work.

Seen in

Last updated · 200 distilled / 1,178 read