Skip to content

Commit

Permalink
Add a benchmark for Unmarshal
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Sep 3, 2020
1 parent c30af2b commit 9c691c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}

0 comments on commit 9c691c4

Please sign in to comment.