Skip to main content

sweep

Function sweep 

Source
pub fn sweep<A>(
    workload: Workload,
    config: &Config,
    threads_sweep: &[usize],
    make_alloc: fn() -> A,
) -> Vec<(usize, f64)>
where A: GlobalAlloc + Send + 'static,
Expand description

Run a thread-count sweep for one workload × allocator.

For each T in threads_sweep, runs run with config.threads = T and returns a Vec<(threads, ops_per_sec)>.

This is the primary entry point for scalability tables: you call sweep once per allocator, zip the results, and print a comparison table.

§Example

use malloc_bench_rs::{sweep, Config, Workload};
use std::alloc::System;

let cfg = Config { threads: 1, steps_per_thread: 1_000, working_set: 64, mstress_blocks: 32 };
let results = sweep(Workload::Larson, &cfg, &[1, 2], || System);
assert_eq!(results.len(), 2);
assert!(results[0].1 > 0.0);