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

Function eager_thread_instantiate

benches/thread_eager_init.rs:75–85  ·  view source on GitHub ↗

This benchmark spawns a new thread, and records the duration to eagerly initializes the thread local resources. It then creates a store and instance, and records the duration it took to execute the first function call.

(engine: Engine, module: Module)

Source from the content-addressed store, hash-verified

73/// instance, and records the duration it took to execute the first function
74/// call.
75fn eager_thread_instantiate(engine: Engine, module: Module) -> (Duration, Duration) {
76 thread::spawn(move || {
77 let init_start = Instant::now();
78 Engine::tls_eager_initialize();
79 let init_duration = init_start.elapsed();
80
81 (init_duration, duration_of_call(&engine, &module))
82 })
83 .join()
84 .expect("thread joins")
85}
86
87fn test_setup() -> (Engine, Module) {
88 // We only expect to create one Instance at a time, with a single memory.

Callers 1

measure_execution_timeFunction · 0.85

Calls 4

spawnFunction · 0.85
duration_of_callFunction · 0.85
expectMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected