Function tiny_bench::bench_labeled

source ยท
pub fn bench_labeled<T, F: FnMut() -> T>(label: &'static str, closure: F)
Expand description

Will run the closure with a label, running with a label enables comparisons for subsequent runs.

use tiny_bench::bench_labeled;
bench_labeled("my_benchmark", || {
    // Some code that should be benched
})
Examples found in repository?
examples/bench_compare.rs (line 5)
3
4
5
6
7
fn main() {
    let label = "compare_functions";
    tiny_bench::bench_labeled(label, my_slow_function);
    tiny_bench::bench_labeled(label, my_faster_function);
}