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

Function test_setup

benches/thread_eager_init.rs:87–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85}
86
87fn test_setup() -> (Engine, Module) {
88 // We only expect to create one Instance at a time, with a single memory.
89 let pool_count = 10;
90
91 let mut pool = PoolingAllocationConfig::default();
92 pool.total_memories(pool_count)
93 .total_stacks(pool_count)
94 .total_tables(pool_count);
95 let mut config = Config::new();
96 config.allocation_strategy(InstanceAllocationStrategy::Pooling(pool));
97 let engine = Engine::new(&config).unwrap();
98
99 // The module has a memory (shouldn't matter) and a single function which is a no-op.
100 let module = Module::new(&engine, r#"(module (memory 1) (func (export "f")))"#).unwrap();
101 (engine, module)
102}
103
104criterion_group!(benches, measure_execution_time);
105criterion_main!(benches);

Callers 1

measure_execution_timeFunction · 0.85

Calls 6

allocation_strategyMethod · 0.80
newFunction · 0.50
total_tablesMethod · 0.45
total_stacksMethod · 0.45
total_memoriesMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected