Creating a store and measuring the time to perform a call is the same behavior in both setups.
(engine: &Engine, module: &Module)
| 49 | /// Creating a store and measuring the time to perform a call is the same behavior |
| 50 | /// in both setups. |
| 51 | fn duration_of_call(engine: &Engine, module: &Module) -> Duration { |
| 52 | let mut store = Store::new(engine, ()); |
| 53 | let inst = Instance::new(&mut store, module, &[]).expect("instantiate"); |
| 54 | let f = inst.get_func(&mut store, "f").expect("get f"); |
| 55 | let f = f.typed::<(), ()>(&store).expect("type f"); |
| 56 | |
| 57 | let call = Instant::now(); |
| 58 | f.call(&mut store, ()).expect("call f"); |
| 59 | call.elapsed() |
| 60 | } |
| 61 | |
| 62 | /// When wasmtime first runs a function on a thread, it needs to initialize |
| 63 | /// some thread-local resources and install signal handlers. This benchmark |
no test coverage detected