1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:04:40 -07:00
go/src/encoding
Filip Gruszczyński 0b9607d1d6 encoding/gob: Speedup map decoding by reducing the allocations.
The improvementis achieved in encoding/gob/decode.go decodeMap by
allocate keyInstr and elemInstr only once and pass it to
decodeIntoValue, instead of allocating a new instance on every loop
cycle.

name                     old time/op  new time/op  delta
DecodeComplex128Slice-8  64.2µs ±10%  62.2µs ± 8%     ~     (p=0.686 n=4+4)
DecodeFloat64Slice-8     37.1µs ± 3%  36.5µs ± 5%     ~     (p=0.343 n=4+4)
DecodeInt32Slice-8       33.7µs ± 3%  32.7µs ± 4%     ~     (p=0.200 n=4+4)
DecodeStringSlice-8      59.7µs ± 5%  57.3µs ± 1%     ~     (p=0.114 n=4+4)
DecodeInterfaceSlice-8    543µs ± 7%   497µs ± 3%     ~     (p=0.057 n=4+4)
DecodeMap-8              3.78ms ± 8%  2.66ms ± 2%  -29.69%  (p=0.029 n=4+4)

Updates #19525

Change-Id: Iec5fa4530de76f0a70da5de8a129a567b4aa096e
Reviewed-on: https://go-review.googlesource.com/38317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-24 19:36:14 +00:00
..
ascii85
asn1 all: make spelling consistent 2016-12-08 23:22:37 +00:00
base32
base64 encoding/base64, html/template: fix grammar mistakes 2017-03-07 17:42:45 +00:00
binary cmd/compile/internal/ssa: combine 2 byte loads + shifts into word load + rolw 8 on AMD64 2017-02-14 22:17:08 +00:00
csv encoding/csv: document Read error behavior 2016-10-28 19:38:12 +00:00
gob encoding/gob: Speedup map decoding by reducing the allocations. 2017-03-24 19:36:14 +00:00
hex encoding/hex: Document DecodedLen. 2016-11-13 17:53:22 +00:00
json encoding/json: reduce unmarshal mallocs for unmapped fields 2017-03-20 23:58:56 +00:00
pem encoding/pem: refuse extra data on ending line 2017-03-01 19:23:09 +00:00
xml encoding/xml: unmarshal allow empty, non-string values 2017-03-22 23:33:36 +00:00
encoding.go