bheisler / criterion.rs

Statistics-driven benchmarking library for Rust
Apache License 2.0
4.28k stars 290 forks source link

Benchmarking With One function result as Input #766

Open kzhui125 opened 3 months ago

kzhui125 commented 3 months ago

I see the doc says how to Benchmarking With One Input

How can I benchmark with input from a function? I don't want to measure the time of function get_input.

fn do_something(size: usize) {
    // Do something with the size
}

fn get_input() -> usize {
    // get random number as input
}

Thanks,