mirror of https://github.com/goccy/go-json.git
test: add benchmark
This commit is contained in:
parent
4bd7d2399f
commit
62b28d102e
|
@ -477,3 +477,13 @@ func Benchmark_Decode_LargeStruct_Stream_GoJsonFirstWinMode(b *testing.B) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Benchmark_Decode_LargeSlice_EscapedString_GoJson(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
var v []string
|
||||
if err := gojson.Unmarshal(LargeSliceEscapedString, &v); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package benchmark
|
|||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/francoispqt/gojay"
|
||||
)
|
||||
|
@ -208,3 +209,5 @@ func NewLargePayloadEasyJson() *LargePayloadEasyJson {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
var LargeSliceEscapedString = []byte("[" + strings.Repeat(",\"simple plain text\\r\\n\"", 10000)[1:] + "]")
|
||||
|
|
Loading…
Reference in New Issue