std::benchBenchmark harness for measuring function performance.
Provides a simple API for timing function execution with nanosecond precision, warm-up iterations, and formatted output.
import std::bench;
fn main() {
let s = bench.suite("My Benchmarks");
s.add("fib_20", 1000, || { fibonacci(20); });
s.report();
}
BenchResultA single benchmark result containing timing statistics.
SuiteA collection of benchmark results.
SuiteMethodsMethods available on a benchmark Suite.
Run a benchmark and record the result.
Executes f for iterations times after a warmup phase
(10% of iterations, minimum 1). Records min, max, avg, and total
timing in nanoseconds.
Print results as a human-readable table.
Print results as a JSON array.