diff --git a/benchmarks/decode_test.go b/benchmarks/decode_test.go index 0626219..5f2a4c2 100644 --- a/benchmarks/decode_test.go +++ b/benchmarks/decode_test.go @@ -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) + } + } +} diff --git a/benchmarks/large_payload.go b/benchmarks/large_payload.go index f6d1c1a..42d8621 100644 --- a/benchmarks/large_payload.go +++ b/benchmarks/large_payload.go @@ -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:] + "]")