diff --git a/benchmarks/decode_test.go b/benchmarks/decode_test.go index f35594e..5d46f9e 100644 --- a/benchmarks/decode_test.go +++ b/benchmarks/decode_test.go @@ -200,7 +200,6 @@ func Benchmark_Decode_LargeStruct_GoJayUnsafe(b *testing.B) { } } -/* func Benchmark_Decode_LargeStruct_GoJson(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { @@ -220,4 +219,3 @@ func Benchmark_Decode_LargeStruct_GoJsonNoEscape(b *testing.B) { } } } -*/ diff --git a/decode_array.go b/decode_array.go index 13258b2..a23e691 100644 --- a/decode_array.go +++ b/decode_array.go @@ -38,6 +38,7 @@ func (d *arrayDecoder) decode(ctx *context, p uintptr) error { cursor = ctx.skipWhiteSpace() switch buf[cursor] { case ']': + ctx.cursor++ return nil case ',': idx++ diff --git a/decode_slice.go b/decode_slice.go index ce01dff..6bc6e2a 100644 --- a/decode_slice.go +++ b/decode_slice.go @@ -58,6 +58,7 @@ func (d *sliceDecoder) decode(ctx *context, p uintptr) error { Len: idx + 1, Cap: cap, } + ctx.cursor++ return nil case ',': idx++ diff --git a/decode_struct.go b/decode_struct.go index 6932b84..0d2b0bd 100644 --- a/decode_struct.go +++ b/decode_struct.go @@ -57,7 +57,10 @@ func (d *structDecoder) skipValue(ctx *context) error { continue } if tk == '"' { - cursor++ + if bracketCount == 0 && braceCount == 0 { + ctx.cursor = cursor + 1 + return nil + } break } }