github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/integration_test/vs/bench_shorthash.go (about) 1 package vs 2 3 import ( 4 _ "embed" 5 "testing" 6 ) 7 8 var ( 9 // shorthashWasm is a wasi binary which runs the same wasm function inside 10 // a loop. See https://github.com/tetratelabs/wazero/issues/947 11 // 12 // Taken from https://github.com/jedisct1/webassembly-benchmarks/tree/master/2022-12/wasm 13 //go:embed testdata/shorthash.wasm 14 shorthashWasm []byte 15 shorthashConfig *RuntimeConfig 16 ) 17 18 func init() { 19 shorthashConfig = &RuntimeConfig{ 20 ModuleName: "shorthash", 21 ModuleWasm: shorthashWasm, 22 NeedsWASI: true, // runs as a _start function 23 } 24 } 25 26 func RunTestShorthash(t *testing.T, runtime func() Runtime) { 27 // not testCall as there are no exported functions except _start 28 testInstantiate(t, runtime, shorthashConfig) 29 } 30 31 func RunBenchmarkShorthash(b *testing.B, runtime func() Runtime) { 32 benchmark(b, runtime, shorthashConfig, nil) 33 }