| Crates.io | many_cpus_benchmarking |
| lib.rs | many_cpus_benchmarking |
| version | 0.1.31 |
| created_at | 2025-03-08 05:36:31.540226+00 |
| updated_at | 2025-09-22 14:54:27.008257+00 |
| description | Criterion benchmark harness to easily compare different processor configurations |
| homepage | |
| repository | https://github.com/folo-rs/folo |
| max_upload_size | |
| id | 1584107 |
| size | 165,491 |
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.