pub struct Workload { /* private fields */ }Expand description
A benchmark workload builder.
Implementations§
Source§impl Workload
impl Workload
Sourcepub fn initial_capacity_log2(&mut self, capacity: u8) -> &mut Self
pub fn initial_capacity_log2(&mut self, capacity: u8) -> &mut Self
Set the initial capacity for the map.
Note that the capacity will be 2^ the given capacity!
The number of operations and the number of pre-filled keys are determined based on the computed initial capacity, so keep that in mind if you change this parameter.
Defaults to 25 (so 2^25 ~= 34M).
Sourcepub fn prefill_fraction(&mut self, fraction: f64) -> &mut Self
pub fn prefill_fraction(&mut self, fraction: f64) -> &mut Self
Set the fraction of the initial table capacity we should populate before running the benchmark.
Defaults to 0%.
Sourcepub fn operations(&mut self, multiple: f64) -> &mut Self
pub fn operations(&mut self, multiple: f64) -> &mut Self
Set the number of operations to run as a multiple of the initial capacity.
This value can exceed 1.0.
Defaults to 0.75 (75%).
Sourcepub fn seed(&mut self, seed: [u8; 32]) -> &mut Self
pub fn seed(&mut self, seed: [u8; 32]) -> &mut Self
Set the seed used to randomize the workload.
The seed does not dictate thread interleaving, so you will only observe the exact same
workload if you run the benchmark with nthreads == 1.
Sourcepub fn run<T: Collection>(&self) -> [u8; 32]
pub fn run<T: Collection>(&self) -> [u8; 32]
Execute this workload against the collection type given by T.
The key type must be Send since we generate the keys on a different thread than the one
we do the benchmarks on.
The key type must be Debug so that we can print meaningful errors if an assertion is
violated during the benchmark.
Returns the seed used for the run.
Sourcepub fn run_silently<T: Collection>(&self) -> Measurement
pub fn run_silently<T: Collection>(&self) -> Measurement
Execute this workload against the collection type given by T.
The key type must be Send since we generate the keys on a different thread than the one
we do the benchmarks on.
The key type must be Debug so that we can print meaningful errors if an assertion is
violated during the benchmark.