go/src/encoding
Filip Gruszczyński f504bc0055 encoding/gob: use MakeMapWithSize when decoding map
This allows to pre-allocate the final size of the hashmap and avoid
re-allocating as we insert entries. Furthermore for the current
implementation of the hashmap it allows avoiding several rounds of
evacuating hashmap entries after each re-allocation.

DecodeComplex128Slice-8  51.9µs ± 1%  51.9µs ± 2%     ~     (p=0.797 n=30+29)
DecodeFloat64Slice-8     31.5µs ± 2%  31.6µs ± 2%     ~     (p=0.050 n=28+28)
DecodeInt32Slice-8       32.0µs ± 2%  31.9µs ± 3%     ~     (p=0.666 n=29+28)
DecodeStringSlice-8      57.7µs ± 2%  57.8µs ± 3%     ~     (p=0.780 n=27+30)
DecodeInterfaceSlice-8    498µs ± 2%   495µs ± 2%     ~     (p=0.070 n=28+29)
DecodeMap-8               300µs ± 2%   230µs ± 5%  -23.31%  (p=0.000 n=27+27)

Updates #19525

Change-Id: Ia7233da49f05bae7a86c064d9ecebca966f5f2f7
Reviewed-on: https://go-review.googlesource.com/40113
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-03 02:43:40 +00:00
..
ascii85 all: single space after period. 2016-03-02 00:13:47 +00:00
asn1 encoding/asn1: add NullBytes and NullRawValue for working with ASN.1 NULL 2017-04-24 22:23:56 +00:00
base32 all: single space after period. 2016-03-02 00:13:47 +00:00
base64 encoding/base64: Optimize DecodeString 2017-04-24 22:40:23 +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: add option to reuse slices returned by Read 2017-04-26 15:55:56 +00:00
gob encoding/gob: use MakeMapWithSize when decoding map 2017-05-03 02:43:40 +00:00
hex encoding/hex: change lookup table back to string 2017-04-18 18:16:08 +00:00
json encoding/json: replace encoderCache RWMutex with a sync.Map 2017-04-28 20:19:10 +00:00
pem encoding/pem: yet another fuzz fake failure 2017-04-03 18:46:56 +00:00
xml encoding/xml: replace tinfoMap RWMutex with sync.Map 2017-04-28 14:36:14 +00:00
encoding.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00