1
0
mirror of https://github.com/golang/go synced 2024-11-06 04:36:15 -07:00
go/src/encoding/json
Pascal S. de Kloe df68afd07c encoding/json: reduce unmarshal mallocs for unmapped fields
JSON decoding performs poorly for unmapped and ignored fields. We noticed better
performance when unmarshalling unused fields. The loss comes mostly from calls
to scanner.error as described at #17914.

benchmark                 old ns/op     new ns/op     delta
BenchmarkIssue10335-8     431           408           -5.34%
BenchmarkUnmapped-8       1744          1314          -24.66%

benchmark                 old allocs     new allocs     delta
BenchmarkIssue10335-8     4              3              -25.00%
BenchmarkUnmapped-8       18             4              -77.78%

benchmark                 old bytes     new bytes     delta
BenchmarkIssue10335-8     320           312           -2.50%
BenchmarkUnmapped-8       568           344           -39.44%

Fixes #17914, improves #10335

Change-Id: I7d4258a94eb287c0fe49e7334795209b90434cd0
Reviewed-on: https://go-review.googlesource.com/33276
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-20 23:58:56 +00:00
..
testdata
bench_test.go encoding/json: reduce unmarshal mallocs for unmapped fields 2017-03-20 23:58:56 +00:00
decode_test.go all: spell "marshal" and "unmarshal" consistently 2016-11-12 00:13:35 +00:00
decode.go encoding/json: reduce unmarshal mallocs for unmapped fields 2017-03-20 23:58:56 +00:00
encode_test.go all: spell "marshal" and "unmarshal" consistently 2016-11-12 00:13:35 +00:00
encode.go encoding/json: document what happens to MarshalText's result 2016-11-22 01:32:20 +00:00
example_marshaling_test.go encoding/json: example on MarshalJSON, UnmarshalJSON 2016-11-03 20:18:52 +00:00
example_test.go
fold_test.go
fold.go
indent.go
number_test.go
scanner_test.go encoding/json: add Valid for checking validity of input bytes 2017-02-07 23:48:44 +00:00
scanner.go encoding/json: add Valid for checking validity of input bytes 2017-02-07 23:48:44 +00:00
stream_test.go
stream.go encoding/json: marshal with null when RawMessage is nil 2016-11-01 05:42:33 +00:00
tables.go
tagkey_test.go encoding/json: explicitly document and test "-" key tag 2016-10-06 14:42:16 +00:00
tags_test.go
tags.go