many_cpus_benchmarking

Crates.iomany_cpus_benchmarking
lib.rsmany_cpus_benchmarking
version0.1.31
created_at2025-03-08 05:36:31.540226+00
updated_at2025-09-22 14:54:27.008257+00
descriptionCriterion benchmark harness to easily compare different processor configurations
homepage
repositoryhttps://github.com/folo-rs/folo
max_upload_size
id1584107
size165,491
Sander Saares (sandersaares)

documentation

README

Criterion benchmark harness designed to compare different modes of distributing work in a many-processor system with multiple memory regions. This helps highlight the performance impact of cross-memory-region data transfers, cross-processor data transfers and multi-threaded logic.

use many_cpus_benchmarking::{Payload, WorkDistribution, execute_runs};

#[derive(Debug, Default)]
struct MyBenchmark {
    data: Option<Vec<u8>>,
}

impl Payload for MyBenchmark {
    fn new_pair() -> (Self, Self) {
        (Self::default(), Self::default())
    }

    fn prepare(&mut self) {
        self.data = Some(vec![99; 1024]);
    }

    fn process(&mut self) {
        // Your benchmark logic here
        let _sum: u32 = self
            .data
            .as_ref()
            .unwrap()
            .iter()
            .map(|&x| u32::from(x))
            .sum();
    }
}

// Run benchmarks with different work distribution modes
fn benchmark(c: &mut criterion::Criterion) {
    execute_runs::<MyBenchmark, 1>(c, WorkDistribution::all());
}

More details in the package documentation.

This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.

Commit count: 810

cargo fmt