Skip to content

Commit

Permalink
Add Benchmark_CheckRuntimeVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Aug 3, 2022
1 parent 0bfa2f5 commit 7b15e83
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/runtime/wasmer/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ func Test_CheckRuntimeVersion(t *testing.T) {
require.Equal(t, expected.TransactionVersion(), version.TransactionVersion())
}

func Benchmark_CheckRuntimeVersion(b *testing.B) {
polkadotRuntimeFilepath, err := runtime.GetRuntime(
context.Background(), runtime.POLKADOT_RUNTIME)
require.NoError(b, err)

b.ResetTimer()
for i := 0; i < b.N; i++ {
code, _ := os.ReadFile(polkadotRuntimeFilepath)
_, _ = CheckRuntimeVersion(code)
}
}

func TestDecompressWasm(t *testing.T) {
encoder, err := zstd.NewWriter(nil)
require.NoError(t, err)
Expand Down

0 comments on commit 7b15e83

Please sign in to comment.