2
0
Fork 0
mirror of https://github.com/ii64/sonic.git synced 2026-06-21 00:46:43 +08:00

Update benchmark (#34)

* chore: update version of goccy/go-json to v0.7.2

* chore: use unordered map option at encoding for go-json's benchmark
This commit is contained in:
Masaaki Goshima 2021-06-26 11:43:10 +09:00 committed by GitHub
parent e9b6634cac
commit 4e02b5b2fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -134,7 +134,7 @@ func BenchmarkEncoder_Generic_GoJson(b *testing.B) {
b.SetBytes(int64(len(TwitterJson)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = gojson.Marshal(_GenericValue)
_, _ = gojson.MarshalWithOption(_GenericValue, gojson.UnorderedMap())
}
}
@ -170,7 +170,7 @@ func BenchmarkEncoder_Binding_GoJson(b *testing.B) {
b.SetBytes(int64(len(TwitterJson)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = gojson.Marshal(&_BindingValue)
_, _ = gojson.MarshalWithOption(&_BindingValue, gojson.UnorderedMap())
}
}
@ -211,7 +211,7 @@ func BenchmarkEncoder_Parallel_Generic_GoJson(b *testing.B) {
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_, _ = gojson.Marshal(_GenericValue)
_, _ = gojson.MarshalWithOption(_GenericValue, gojson.UnorderedMap())
}
})
}
@ -255,7 +255,7 @@ func BenchmarkEncoder_Parallel_Binding_GoJson(b *testing.B) {
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_, _ = gojson.Marshal(&_BindingValue)
_, _ = gojson.MarshalWithOption(&_BindingValue, gojson.UnorderedMap())
}
})
}

2
go.mod
View file

@ -5,7 +5,7 @@ go 1.15
require (
github.com/chenzhuoyu/base64x v0.0.0-20210528162528-3c6c11c43ee5
github.com/davecgh/go-spew v1.1.1
github.com/goccy/go-json v0.7.1
github.com/goccy/go-json v0.7.2
github.com/json-iterator/go v1.1.10
github.com/klauspost/cpuid/v2 v2.0.6
github.com/stretchr/testify v1.7.0

4
go.sum
View file

@ -3,8 +3,8 @@ github.com/chenzhuoyu/base64x v0.0.0-20210528162528-3c6c11c43ee5/go.mod h1:NfDzX
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/goccy/go-json v0.7.1 h1:VMhnh5gcc8De8f6m2DLvSqY1x8Jwl3btet+EqMP0QNs=
github.com/goccy/go-json v0.7.1/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/goccy/go-json v0.7.2 h1:MY1gMmtCxRpaI8YGpeHCvXUb+FVIo09pnjqF9Rhh274=
github.com/goccy/go-json v0.7.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=