Crates.io | statslicer |
lib.rs | statslicer |
version | 0.7.0 |
source | src |
created_at | 2024-01-15 19:06:46.671259 |
updated_at | 2024-12-04 14:15:15.26387 |
description | Guacamole provides a linearly-seekable random number generator. |
homepage | |
repository | https://github.com/rescrv/blue |
max_upload_size | |
id | 1100622 |
size | 65,111 |
Statslicer is a platform for running experiments and collecting their results.
use guacamole::combinators::*;
use guacamole::Guacamole;
use statslicer::{benchmark, black_box, statslicer_main, Bencher, Parameter, Parameters};
#[derive(Debug, Default, Eq, PartialEq)]
struct MyParameters {
elements: usize,
}
impl Parameters for MyParameters {
fn params(&self) -> Vec<(&'static str, Parameter)> {
vec![
("elements", Parameter::Integer(self.elements as u64)),
]
}
}
fn bench_sort(params: &MyParameters, b: &mut Bencher) {
let mut guac = Guacamole::new(b.seed());
let array = to_vec(constant(params.elements), any::<u64>)(&mut guac);
let bin_searches = to_vec(constant(b.size()), any::<u64>)(&mut guac);
b.run(|| {
for needle in bin_searches.iter() {
let _ = black_box(array.binary_search(needle));
}
});
}
benchmark! {
name = my_sort_benchmark;
MyParameters {
elements in [0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024],
}
bench_sort
}
statslicer_main! { my_sort_benchmark }
Experimental. Likely to change in the near future.
This library provides the statslicer benchmark tools and a binary to derive data and colate histograms.
The latest documentation is always available at docs.rs.