From 4e02b5b2fefb2ab0b16fc68fce3e9781e1b0bf3f Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sat, 26 Jun 2021 11:43:10 +0900 Subject: [PATCH] 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 --- encoder/encoder_test.go | 8 ++++---- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/encoder/encoder_test.go b/encoder/encoder_test.go index 9c571bd..5e5f98e 100644 --- a/encoder/encoder_test.go +++ b/encoder/encoder_test.go @@ -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()) } }) } diff --git a/go.mod b/go.mod index ba2c044..3486e22 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 36e8d53..66a7327 100644 --- a/go.sum +++ b/go.sum @@ -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=