MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / bench_write_all

Function bench_write_all

crates/tinywasm/benches/memory_backends.rs:36–51  ·  view source on GitHub ↗
(
    group: &mut BenchmarkGroup<'_, WallTime>,
    backend: &str,
    workload: &str,
    mut memory: M,
    offset: usize,
    len: usize,
)

Source from the content-addressed store, hash-verified

34}
35
36fn bench_write_all<M: LinearMemory>(
37 group: &mut BenchmarkGroup<'_, WallTime>,
38 backend: &str,
39 workload: &str,
40 mut memory: M,
41 offset: usize,
42 len: usize,
43) {
44 let src = vec![0xA5; len];
45 group.bench_function(BenchmarkId::new(format!("write_all/{workload}"), backend), |b| {
46 b.iter(|| {
47 memory.write_all(offset, black_box(&src)).unwrap();
48 black_box(memory.len())
49 })
50 });
51}
52
53fn bench_read_exact<M: LinearMemory>(
54 group: &mut BenchmarkGroup<'_, WallTime>,

Callers 1

criterion_benchmarkFunction · 0.85

Calls 2

write_allMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected