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

Function duration_of_call

benches/thread_eager_init.rs:51–60  ·  view source on GitHub ↗

Creating a store and measuring the time to perform a call is the same behavior in both setups.

(engine: &Engine, module: &Module)

Source from the content-addressed store, hash-verified

49/// Creating a store and measuring the time to perform a call is the same behavior
50/// in both setups.
51fn 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

Callers 2

lazy_thread_instantiateFunction · 0.85
eager_thread_instantiateFunction · 0.85

Calls 4

newFunction · 0.50
expectMethod · 0.45
get_funcMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected