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!;
extern crate benchmarking;
const VEC_LENGTH: usize = 100;
warm_up;
let bench_result = measure_function_n
.unwrap;
println!;
println!;
The warm_up
and warm_up_with_duration
functions of the benchmarking
crate runs on one thread. To warm up all CPUs, you can use the warm_up_multi_thread
and warm_up_multi_thread_with_duration
functions instead.
The measure_function
and measure_function_with_times
functions of the benchmarking
crate can execute a closure for N times. To execute it repeatly for a while instead, you can use the bench_function
and bench_function_with_duration
functions.
To execute a closure with multiple threads to measure the throughput, you can use the multi_thread_bench_function
and multi_thread_bench_function_with_duration
functions of the benchmarking
crate.