Skip to content

Commit 12cb9f8

Browse files
committed
removed sonic benchmark
1 parent 86005fd commit 12cb9f8

File tree

5 files changed

+0
-177
lines changed

5 files changed

+0
-177
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ go 1.13
44

55
require (
66
github.com/andot/complexconv v1.0.0
7-
github.com/bytedance/sonic v1.0.2
87
github.com/google/uuid v1.3.0
98
github.com/gorilla/websocket v1.4.2
109
github.com/json-iterator/go v1.1.12

go.sum

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
github.com/andot/complexconv v1.0.0 h1:qf8jmr+vaqM2ll7LzzOXqzNn1oVa4+DuyBVKs4DWS5c=
22
github.com/andot/complexconv v1.0.0/go.mod h1:JGf7t92n2pKxZNdOe/1n+vJqyi4WPSop/fRIp1de6LE=
3-
github.com/bytedance/sonic v1.0.2 h1:kp1nbHyPBRzjZSJPEqHDXqBzns6/3Ef7gVhwtZwf5Bo=
4-
github.com/bytedance/sonic v1.0.2/go.mod h1:V973WhNhGmvHxW6nQmsHEfHaoU9F3zTF+93rH03hcUQ=
5-
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06 h1:1sDoSuDPWzhkdzNVxCxtIaKiAe96ESVPv8coGwc1gZ4=
6-
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
73
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
84
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
95
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
10-
github.com/goccy/go-json v0.9.4 h1:L8MLKG2mvVXiQu07qB6hmfqeSYQdOnqPot2GhsIwIaI=
11-
github.com/goccy/go-json v0.9.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
126
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
137
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
148
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
159
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
1610
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
1711
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
1812
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
19-
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
20-
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
2113
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
2214
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
2315
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
@@ -30,21 +22,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
3022
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
3123
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
3224
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
33-
github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
34-
github.com/tidwall/gjson v1.13.0 h1:3TFY9yxOQShrvmjdM76K+jc66zJeT6D3/VFFYCGQf7M=
35-
github.com/tidwall/gjson v1.13.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
36-
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
37-
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
38-
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
39-
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
40-
github.com/tidwall/sjson v1.2.4 h1:cuiLzLnaMeBhRmEv00Lpk3tkYrcxpmbU81tAY4Dw0tc=
41-
github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM=
42-
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
43-
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
44-
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
45-
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
4625
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
4726
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
4827
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
4928
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
50-
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

io/bool_decoder_test.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import (
1919
"strings"
2020
"testing"
2121

22-
"github.com/bytedance/sonic/decoder"
23-
"github.com/bytedance/sonic/encoder"
2422
. "github.com/hprose/hprose-golang/v3/io"
2523
jsoniter "github.com/json-iterator/go"
2624
"github.com/stretchr/testify/assert"
@@ -168,25 +166,3 @@ func BenchmarkJsonDecodeBool(b *testing.B) {
168166
dec.Decode(&f)
169167
}
170168
}
171-
172-
func BenchmarkSonicJsonDecodeBool(b *testing.B) {
173-
sb := &strings.Builder{}
174-
enc := encoder.Encoder{}
175-
bytes, _ := enc.Encode(true)
176-
sb.Write(bytes)
177-
bytes, _ = enc.Encode(false)
178-
sb.Write(bytes)
179-
bytes, _ = enc.Encode("true")
180-
sb.Write(bytes)
181-
bytes, _ = enc.Encode("false")
182-
sb.Write(bytes)
183-
data := sb.String()
184-
var t, f bool
185-
for i := 0; i < b.N; i++ {
186-
dec := decoder.NewDecoder(data)
187-
dec.Decode(&t)
188-
dec.Decode(&f)
189-
dec.Decode(&t)
190-
dec.Decode(&f)
191-
}
192-
}

io/decoder_test.go

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import (
2020
"testing"
2121
"time"
2222

23-
"github.com/bytedance/sonic/decoder"
24-
"github.com/bytedance/sonic/encoder"
2523
. "github.com/hprose/hprose-golang/v3/io"
2624
jsoniter "github.com/json-iterator/go"
2725
"github.com/stretchr/testify/assert"
@@ -408,58 +406,6 @@ func BenchmarkJsonDecodeStruct(b *testing.B) {
408406
}
409407
}
410408

411-
func BenchmarkSonicJsonDecodeStruct(b *testing.B) {
412-
sb := &strings.Builder{}
413-
enc := encoder.Encoder{}
414-
type TestStruct struct {
415-
Name string
416-
Age int
417-
Birthday time.Time
418-
Male bool
419-
}
420-
ts := &TestStruct{
421-
Name: "Tom",
422-
Age: 18,
423-
Birthday: time.Date(2002, 1, 2, 3, 4, 5, 6, time.Local),
424-
Male: true,
425-
}
426-
bytes, _ := enc.Encode(ts)
427-
sb.Write(bytes)
428-
bytes, _ = enc.Encode(ts)
429-
sb.Write(bytes)
430-
bytes, _ = enc.Encode(ts)
431-
sb.Write(bytes)
432-
bytes, _ = enc.Encode(ts)
433-
sb.Write(bytes)
434-
bytes, _ = enc.Encode(ts)
435-
sb.Write(bytes)
436-
bytes, _ = enc.Encode(ts)
437-
sb.Write(bytes)
438-
bytes, _ = enc.Encode(ts)
439-
sb.Write(bytes)
440-
bytes, _ = enc.Encode(ts)
441-
sb.Write(bytes)
442-
bytes, _ = enc.Encode(ts)
443-
sb.Write(bytes)
444-
bytes, _ = enc.Encode(ts)
445-
sb.Write(bytes)
446-
data := sb.String()
447-
var obj TestStruct
448-
for i := 0; i < b.N; i++ {
449-
dec := decoder.NewDecoder(data)
450-
dec.Decode(&obj)
451-
dec.Decode(&obj)
452-
dec.Decode(&obj)
453-
dec.Decode(&obj)
454-
dec.Decode(&obj)
455-
dec.Decode(&obj)
456-
dec.Decode(&obj)
457-
dec.Decode(&obj)
458-
dec.Decode(&obj)
459-
dec.Decode(&obj)
460-
}
461-
}
462-
463409
func BenchmarkCopy(b *testing.B) {
464410
src := []byte{}
465411
for i := 0; i < 100000; i++ {

io/encoder_test.go

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"testing"
2323
"time"
2424

25-
"github.com/bytedance/sonic/encoder"
2625
. "github.com/hprose/hprose-golang/v3/io"
2726
jsoniter "github.com/json-iterator/go"
2827
"github.com/stretchr/testify/assert"
@@ -676,22 +675,6 @@ func BenchmarkJsonEncodeSlice(b *testing.B) {
676675
}
677676
}
678677

679-
func BenchmarkSonicJsonEncodeSlice(b *testing.B) {
680-
sb := &strings.Builder{}
681-
enc := encoder.Encoder{}
682-
slice := []int16{
683-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
684-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
685-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
686-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
687-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
688-
}
689-
for i := 0; i < b.N; i++ {
690-
bytes, _ := enc.Encode(slice)
691-
sb.Write(bytes)
692-
}
693-
}
694-
695678
func BenchmarkHproseEncodeArray(b *testing.B) {
696679
sb := &strings.Builder{}
697680
enc := NewEncoder(sb).Simple(false)
@@ -737,22 +720,6 @@ func BenchmarkJsonEncodeArray(b *testing.B) {
737720
}
738721
}
739722

740-
func BenchmarkSonicJsonEncodeArray(b *testing.B) {
741-
sb := &strings.Builder{}
742-
enc := encoder.Encoder{}
743-
array := [50]int16{
744-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
745-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
746-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
747-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
748-
1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
749-
}
750-
for i := 0; i < b.N; i++ {
751-
bytes, _ := enc.Encode(array)
752-
sb.Write(bytes)
753-
}
754-
}
755-
756723
func BenchmarkHproseEncodeMap(b *testing.B) {
757724
sb := &strings.Builder{}
758725
enc := NewEncoder(sb).Simple(false)
@@ -813,27 +780,6 @@ func BenchmarkJsonEncodeMap(b *testing.B) {
813780
}
814781
}
815782

816-
func BenchmarkSonicJsonEncodeMap(b *testing.B) {
817-
sb := &strings.Builder{}
818-
enc := encoder.Encoder{}
819-
m := map[int16]int16{
820-
1: 1,
821-
2: 2,
822-
3: 3,
823-
4: 4,
824-
5: 5,
825-
6: 6,
826-
7: 7,
827-
8: 8,
828-
9: 9,
829-
0: 0,
830-
}
831-
for i := 0; i < b.N; i++ {
832-
bytes, _ := enc.Encode(m)
833-
sb.Write(bytes)
834-
}
835-
}
836-
837783
func BenchmarkHproseEncodeStruct(b *testing.B) {
838784
sb := &strings.Builder{}
839785
enc := NewEncoder(sb).Simple(false)
@@ -893,25 +839,3 @@ func BenchmarkJsonEncodeStruct(b *testing.B) {
893839
enc.Encode(ts)
894840
}
895841
}
896-
897-
func BenchmarkSonicJsonEncodeStruct(b *testing.B) {
898-
sb := &strings.Builder{}
899-
enc := encoder.Encoder{}
900-
type TestStruct struct {
901-
Name string
902-
Age int
903-
Birthday time.Time
904-
Male bool
905-
}
906-
ts := &TestStruct{
907-
Name: "Tom",
908-
Age: 18,
909-
Birthday: time.Date(2002, 1, 2, 3, 4, 5, 6, time.Local),
910-
Male: true,
911-
}
912-
encoder.Pretouch(reflect.TypeOf(ts))
913-
for i := 0; i < b.N; i++ {
914-
bytes, _ := enc.Encode(ts)
915-
sb.Write(bytes)
916-
}
917-
}

0 commit comments

Comments
 (0)