Benchmarking
This crate can be used to execute something and measure the execution time. It does not output anything to screens and filesystems.
Examples
extern crate benchmarking;
const VEC_LENGTH: usize = 100;
warm_up;
let bench_result = measure_function.unwrap;
println!;
extern crate benchmarking;
const VEC_LENGTH: usize = 100;
warm_up;
let bench_result = measure_function.unwrap;
println!;
extern crate benchmarking;
const VEC_LENGTH: usize = 100;
warm_up;
let bench_result = measure_function.unwrap;
println!;
- The
warm_up
andwarm_up_with_duration
functions of thebenchmarking
crate runs on one thread. To warm up all CPUs, you can use thewarm_up_multi_thread
andwarm_up_multi_thread_with_duration
functions instead. - The
measure_function
andmeasure_function_with_times
functions of thebenchmarking
crate can execute a closure for N times. To execute it repeatly for a while instead, you can use thebench_function
andbench_function_with_duration
functions. - To execute a closure with multiple threads to measure the throughput, you can use the
multi_thread_bench_function
andmulti_thread_bench_function_with_duration
functions of thebenchmarking
crate.
Crates.io
https://crates.io/crates/benchmarking