statslicer

Crates.iostatslicer
lib.rsstatslicer
version0.7.0
sourcesrc
created_at2024-01-15 19:06:46.671259
updated_at2024-12-04 14:15:15.26387
descriptionGuacamole provides a linearly-seekable random number generator.
homepage
repositoryhttps://github.com/rescrv/blue
max_upload_size
id1100622
size65,111
Robert Escriva (rescrv)

documentation

README

statslicer

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 }

Status

Experimental. Likely to change in the near future.

Scope

This library provides the statslicer benchmark tools and a binary to derive data and colate histograms.

Warts

Documentation

The latest documentation is always available at docs.rs.

Commit count: 1605

cargo fmt