MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / bench_many_stack_frames_traps

Function bench_many_stack_frames_traps

benches/trap.rs:125–153  ·  view source on GitHub ↗
(c: &mut Criterion)

Source from the content-addressed store, hash-verified

123}
124
125fn bench_many_stack_frames_traps(c: &mut Criterion) {
126 let mut group = c.benchmark_group("many-stack-frames-traps");
127
128 for num_stack_frames in vec![1, 8, 64, 512] {
129 group.throughput(Throughput::Elements(num_stack_frames));
130 group.bench_with_input(
131 BenchmarkId::from_parameter(num_stack_frames),
132 &num_stack_frames,
133 |b, &num_stack_frames| {
134 let engine = Engine::default();
135 let module = module(&engine, num_stack_frames).unwrap();
136
137 b.iter_custom(|iters| {
138 let mut store = Store::new(&engine, ());
139 let instance = Instance::new(&mut store, &module, &[]).unwrap();
140 let f = instance.get_typed_func::<(), ()>(&mut store, "").unwrap();
141
142 let start = std::time::Instant::now();
143 for _ in 0..iters {
144 assert!(f.call(&mut store, ()).is_err());
145 }
146 start.elapsed()
147 });
148 },
149 );
150 }
151
152 group.finish()
153}
154
155fn bench_host_wasm_frames_traps(c: &mut Criterion) {
156 let mut group = c.benchmark_group("host-wasm-frames-traps");

Callers 1

bench_trapsFunction · 0.85

Calls 4

moduleFunction · 0.70
newFunction · 0.50
unwrapMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected