Skip to main content

bench

Attribute Macro bench 

Source
#[bench]
Expand description

Register a bench harness function, optionally fed by a setup fn.

ⓘ
#[soothfast::bench(group = "sort", setup_sized = values_n, sizes(1024, 4096, 16384),
                 complexity = "n log n", alloc = 2, covers = "mylib::sorted")]
fn bench_sorted(input: &[f64]) { soothfast::keep(mylib::sorted(input)); }

setup = f feeds f() -> T as &T; setup_sized = f feeds f(n) -> T and enables sizes(...)/complexity sweeps (the plain measurement uses the largest size). Setup always runs outside the measured region. Route constant inputs through soothfast::keep or LLVM const-folds them.