Crates.io | scaling |
lib.rs | scaling |
version | 0.1.3 |
source | src |
created_at | 2021-03-30 13:10:17.562735 |
updated_at | 2021-03-30 18:44:22.126489 |
description | A lightweight benchmarking library that measures scaling behavior |
homepage | |
repository | https://github.com/droundy/easybench-rs |
max_upload_size | |
id | 375749 |
size | 51,364 |
A lightweight benchmarking library which:
use easybench::{bench,bench_env};
// Simple benchmarks are performed with `bench`.
println!("fib 200: {}", bench(|| fib(200) ));
println!("fib 500: {}", bench(|| fib(500) ));
// If a function needs to mutate some state, use `bench_env`.
println!("reverse: {}", bench_env(vec![1,2,3], |xs| xs.reverse()));
println!("sort: {}", bench_env(vec![1,2,3], |xs| xs.sort()));
Running the above yields the following:
fib 200: 38 ns (R²=1.000, 26053498 iterations in 155 samples)
fib 500: 109 ns (R²=1.000, 9131585 iterations in 144 samples)
reverse: 3 ns (R²=0.998, 23684997 iterations in 154 samples)
sort: 3 ns (R²=0.999, 23684997 iterations in 154 samples)
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.