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

Function criterion_benchmark

crates/tinywasm/benches/tinywasm.rs:36–47  ·  view source on GitHub ↗
(c: &mut Criterion)

Source from the content-addressed store, hash-verified

34}
35
36fn criterion_benchmark(c: &mut Criterion) {
37 let module = tinywasm_parse().expect("tinywasm_parse");
38 let twasm = tinywasm_to_twasm(&module).expect("tinywasm_to_twasm");
39 let mut group = c.benchmark_group("tinywasm");
40
41 group.measurement_time(std::time::Duration::from_secs(2));
42 group.bench_function("tinywasm_parse", |b| b.iter(tinywasm_parse));
43 group.bench_function("tinywasm_to_twasm", |b| b.iter(|| tinywasm_to_twasm(&module)));
44 group.bench_function("tinywasm_from_twasm", |b| b.iter(|| tinywasm_from_twasm(&twasm)));
45 group.measurement_time(std::time::Duration::from_secs(10));
46 group.bench_function("tinywasm", |b| b.iter(|| tinywasm_run(&module)));
47}
48
49criterion_group!(benches, criterion_benchmark);
50criterion_main!(benches);

Callers

nothing calls this directly

Calls 4

tinywasm_to_twasmFunction · 0.85
tinywasm_from_twasmFunction · 0.85
tinywasm_runFunction · 0.85
tinywasm_parseFunction · 0.70

Tested by

no test coverage detected