(
group: &mut BenchmarkGroup<'_, WallTime>,
backend: &str,
workload: &str,
mut memory: M,
offset: usize,
len: usize,
)
| 51 | } |
| 52 | |
| 53 | fn bench_read_exact<M: LinearMemory>( |
| 54 | group: &mut BenchmarkGroup<'_, WallTime>, |
| 55 | backend: &str, |
| 56 | workload: &str, |
| 57 | mut memory: M, |
| 58 | offset: usize, |
| 59 | len: usize, |
| 60 | ) { |
| 61 | let src = vec![0x5A; len]; |
| 62 | memory.write_all(offset, &src).unwrap(); |
| 63 | |
| 64 | let mut dst = vec![0; len]; |
| 65 | group.bench_function(BenchmarkId::new(format!("read_exact/{workload}"), backend), |b| { |
| 66 | b.iter(|| { |
| 67 | memory.read_exact(offset, black_box(&mut dst)).unwrap(); |
| 68 | black_box(&dst); |
| 69 | }) |
| 70 | }); |
| 71 | } |
| 72 | |
| 73 | fn criterion_benchmark(c: &mut Criterion) { |
| 74 | let mut group = c.benchmark_group("memory_backends"); |
no test coverage detected