Sort benchmark target

This commit is contained in:
Masaaki Goshima 2021-06-21 23:57:46 +09:00
parent 01698ac4a5
commit 291234afdb
1 changed files with 66 additions and 66 deletions

View File

@ -34,6 +34,16 @@ func Benchmark_Decode_SmallStruct_Unmarshal_FastJson(b *testing.B) {
} }
} }
func Benchmark_Decode_SmallStruct_Unmarshal_SegmentioJson(b *testing.B) {
b.ReportAllocs()
for n := 0; n < b.N; n++ {
result := SmallPayload{}
if err := segmentiojson.Unmarshal(SmallFixture, &result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_SmallStruct_Unmarshal_Sonic(b *testing.B) { func Benchmark_Decode_SmallStruct_Unmarshal_Sonic(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
for n := 0; n < b.N; n++ { for n := 0; n < b.N; n++ {
@ -74,16 +84,6 @@ func Benchmark_Decode_SmallStruct_Unmarshal_GoJayUnsafe(b *testing.B) {
} }
} }
func Benchmark_Decode_SmallStruct_Unmarshal_SegmentioJson(b *testing.B) {
b.ReportAllocs()
for n := 0; n < b.N; n++ {
result := SmallPayload{}
if err := segmentiojson.Unmarshal(SmallFixture, &result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_SmallStruct_Unmarshal_GoJson(b *testing.B) { func Benchmark_Decode_SmallStruct_Unmarshal_GoJson(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
@ -116,6 +116,18 @@ func Benchmark_Decode_SmallStruct_Stream_EncodingJson(b *testing.B) {
} }
} }
func Benchmark_Decode_SmallStruct_Stream_SegmentioJson(b *testing.B) {
b.ReportAllocs()
reader := bytes.NewReader(SmallFixture)
for i := 0; i < b.N; i++ {
result := SmallPayload{}
reader.Reset(SmallFixture)
if err := segmentiojson.NewDecoder(reader).Decode(&result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_SmallStruct_Stream_JsonIter(b *testing.B) { func Benchmark_Decode_SmallStruct_Stream_JsonIter(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
reader := bytes.NewReader(SmallFixture) reader := bytes.NewReader(SmallFixture)
@ -140,18 +152,6 @@ func Benchmark_Decode_SmallStruct_Stream_GoJay(b *testing.B) {
} }
} }
func Benchmark_Decode_SmallStruct_Stream_SegmentioJson(b *testing.B) {
b.ReportAllocs()
reader := bytes.NewReader(SmallFixture)
for i := 0; i < b.N; i++ {
result := SmallPayload{}
reader.Reset(SmallFixture)
if err := segmentiojson.NewDecoder(reader).Decode(&result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_SmallStruct_Stream_GoJson(b *testing.B) { func Benchmark_Decode_SmallStruct_Stream_GoJson(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
reader := bytes.NewReader(SmallFixture) reader := bytes.NewReader(SmallFixture)
@ -195,6 +195,16 @@ func Benchmark_Decode_MediumStruct_Unmarshal_Sonic(b *testing.B) {
} }
} }
func Benchmark_Decode_MediumStruct_Unmarshal_SegmentioJson(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
result := MediumPayload{}
if err := segmentiojson.Unmarshal(MediumFixture, &result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_MediumStruct_Unmarshal_JsonIter(b *testing.B) { func Benchmark_Decode_MediumStruct_Unmarshal_JsonIter(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
for n := 0; n < b.N; n++ { for n := 0; n < b.N; n++ {
@ -225,16 +235,6 @@ func Benchmark_Decode_MediumStruct_Unmarshal_GoJayUnsafe(b *testing.B) {
} }
} }
func Benchmark_Decode_MediumStruct_Unmarshal_SegmentioJson(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
result := MediumPayload{}
if err := segmentiojson.Unmarshal(MediumFixture, &result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_MediumStruct_Unmarshal_GoJson(b *testing.B) { func Benchmark_Decode_MediumStruct_Unmarshal_GoJson(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
@ -267,6 +267,18 @@ func Benchmark_Decode_MediumStruct_Stream_EncodingJson(b *testing.B) {
} }
} }
func Benchmark_Decode_MediumStruct_Stream_SegmentioJson(b *testing.B) {
b.ReportAllocs()
reader := bytes.NewReader(MediumFixture)
for n := 0; n < b.N; n++ {
reader.Reset(MediumFixture)
result := MediumPayload{}
if err := segmentiojson.NewDecoder(reader).Decode(&result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_MediumStruct_Stream_JsonIter(b *testing.B) { func Benchmark_Decode_MediumStruct_Stream_JsonIter(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
reader := bytes.NewReader(MediumFixture) reader := bytes.NewReader(MediumFixture)
@ -291,18 +303,6 @@ func Benchmark_Decode_MediumStruct_Stream_GoJay(b *testing.B) {
} }
} }
func Benchmark_Decode_MediumStruct_Stream_SegmentioJson(b *testing.B) {
b.ReportAllocs()
reader := bytes.NewReader(MediumFixture)
for n := 0; n < b.N; n++ {
reader.Reset(MediumFixture)
result := MediumPayload{}
if err := segmentiojson.NewDecoder(reader).Decode(&result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_MediumStruct_Stream_GoJson(b *testing.B) { func Benchmark_Decode_MediumStruct_Stream_GoJson(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
reader := bytes.NewReader(MediumFixture) reader := bytes.NewReader(MediumFixture)
@ -346,6 +346,16 @@ func Benchmark_Decode_LargeStruct_Unmarshal_Sonic(b *testing.B) {
} }
} }
func Benchmark_Decode_LargeStruct_Unmarshal_SegmentioJson(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
result := LargePayload{}
if err := segmentiojson.Unmarshal(LargeFixture, &result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_LargeStruct_Unmarshal_JsonIter(b *testing.B) { func Benchmark_Decode_LargeStruct_Unmarshal_JsonIter(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
for n := 0; n < b.N; n++ { for n := 0; n < b.N; n++ {
@ -376,16 +386,6 @@ func Benchmark_Decode_LargeStruct_Unmarshal_GoJayUnsafe(b *testing.B) {
} }
} }
func Benchmark_Decode_LargeStruct_Unmarshal_SegmentioJson(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
result := LargePayload{}
if err := segmentiojson.Unmarshal(LargeFixture, &result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_LargeStruct_Unmarshal_GoJson(b *testing.B) { func Benchmark_Decode_LargeStruct_Unmarshal_GoJson(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
@ -446,6 +446,18 @@ func Benchmark_Decode_LargeStruct_Stream_EncodingJson(b *testing.B) {
} }
} }
func Benchmark_Decode_LargeStruct_Stream_SegmentioJson(b *testing.B) {
b.ReportAllocs()
reader := bytes.NewReader(LargeFixture)
for i := 0; i < b.N; i++ {
result := LargePayload{}
reader.Reset(LargeFixture)
if err := segmentiojson.NewDecoder(reader).Decode(&result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_LargeStruct_Stream_JsonIter(b *testing.B) { func Benchmark_Decode_LargeStruct_Stream_JsonIter(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
reader := bytes.NewReader(LargeFixture) reader := bytes.NewReader(LargeFixture)
@ -470,18 +482,6 @@ func Benchmark_Decode_LargeStruct_Stream_GoJay(b *testing.B) {
} }
} }
func Benchmark_Decode_LargeStruct_Stream_SegmentioJson(b *testing.B) {
b.ReportAllocs()
reader := bytes.NewReader(LargeFixture)
for i := 0; i < b.N; i++ {
result := LargePayload{}
reader.Reset(LargeFixture)
if err := segmentiojson.NewDecoder(reader).Decode(&result); err != nil {
b.Fatal(err)
}
}
}
func Benchmark_Decode_LargeStruct_Stream_GoJson(b *testing.B) { func Benchmark_Decode_LargeStruct_Stream_GoJson(b *testing.B) {
b.ReportAllocs() b.ReportAllocs()
reader := bytes.NewReader(LargeFixture) reader := bytes.NewReader(LargeFixture)