(c: &mut Criterion)
| 123 | } |
| 124 | |
| 125 | fn 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 | |
| 155 | fn bench_host_wasm_frames_traps(c: &mut Criterion) { |
| 156 | let mut group = c.benchmark_group("host-wasm-frames-traps"); |
no test coverage detected