github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/integration_test/bench/decoder_bench_test.go (about)

     1  package bench
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/wasilibs/wazerox/api"
     7  	"github.com/wasilibs/wazerox/internal/wasm"
     8  	"github.com/wasilibs/wazerox/internal/wasm/binary"
     9  )
    10  
    11  func BenchmarkCodec(b *testing.B) {
    12  	b.Run("binary.DecodeModule", func(b *testing.B) {
    13  		b.ReportAllocs()
    14  		for i := 0; i < b.N; i++ {
    15  			if _, err := binary.DecodeModule(caseWasm, api.CoreFeaturesV2, wasm.MemoryLimitPages, false, false, false); err != nil {
    16  				b.Fatal(err)
    17  			}
    18  		}
    19  	})
    20  }