Skip to content

Commit

Permalink
test(bench): Add tidwallgjson to benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
romshark committed Jan 15, 2022
1 parent a03a045 commit effc38c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,10 @@ func TestValid(t *testing.T) {
require.True(t, encodingjson.Valid([]byte(j)))
})

t.Run("tidwallgjson", func(t *testing.T) {
require.True(t, tidwallgjson.Valid(j))
})

t.Run("fast-json", func(t *testing.T) {
require.NoError(t, valyalafastjson.Validate(j))
})
Expand Down Expand Up @@ -628,6 +632,14 @@ func BenchmarkValid(b *testing.B) {
}
})

b.Run("tidwallgjson", func(b *testing.B) {
j := string(bb.input)
b.ResetTimer()
for i := 0; i < b.N; i++ {
gbool = tidwallgjson.Valid(j)
}
})

b.Run("valyala-fastjson", func(b *testing.B) {
for i := 0; i < b.N; i++ {
gbool = (valyalafastjson.ValidateBytes(bb.input) != nil)
Expand Down

0 comments on commit effc38c

Please sign in to comment.