From 9c691c423a33626c860de76d6b68c4ccde2c6f42 Mon Sep 17 00:00:00 2001 From: itchyny Date: Thu, 3 Sep 2020 19:57:34 +0900 Subject: [PATCH] Add a benchmark for Unmarshal --- decode_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/decode_test.go b/decode_test.go index 7c68819..3b478f6 100644 --- a/decode_test.go +++ b/decode_test.go @@ -96,3 +96,15 @@ func TestUnmarshal(t *testing.T) { } } } + +func BenchmarkUnmarshalStruct(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, tt := range decodeTests { + s := &ss{} + err := Unmarshal([]byte(tt.Input), s) + if err != nil { + b.Error(err) + } + } + } +}