go/src/encoding/gob
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
..
codec_test.go encoding/gob: Speedup map decoding by reducing the allocations. 2017-03-24 19:36:14 +00:00
debug.go all: single space after period. 2016-03-02 00:13:47 +00:00
dec_helpers.go encoding/gob: reduce the amount of memory allocations. 2015-11-25 17:01:25 +00:00
decgen.go encoding/gob: reduce the amount of memory allocations. 2015-11-25 17:01:25 +00:00
decode.go encoding/gob: Speedup map decoding by reducing the allocations. 2017-03-24 19:36:14 +00:00
decoder.go all: single space after period. 2016-03-02 00:13:47 +00:00
doc.go encoding/gob: document the extra byte after a singleton 2017-03-21 04:07:46 +00:00
dump.go
enc_helpers.go encoding/gob: custom array/slice decoders 2014-10-17 12:37:41 -07:00
encgen.go encoding/gob: custom array/slice decoders 2014-10-17 12:37:41 -07:00
encode.go encoding/gob: speedup floats encoding and decoding 2017-03-18 18:30:41 +00:00
encoder.go encoding/gob: error out instead of panicking on nil dereference 2016-08-19 21:54:39 +00:00
encoder_test.go encoding/gob: add Encode-Decode Int slices tests 2017-03-13 20:22:39 +00:00
error.go all: single space after period. 2016-03-02 00:13:47 +00:00
example_encdec_test.go
example_interface_test.go all: single space after period. 2016-03-02 00:13:47 +00:00
example_test.go all: single space after period. 2016-03-02 00:13:47 +00:00
gobencdec_test.go time: record monotonic clock reading in time.Now, for more accurate comparisons 2017-02-03 19:04:52 +00:00
timing_test.go encoding/gob: Speedup map decoding by reducing the allocations. 2017-03-24 19:36:14 +00:00
type.go all: single space after period. 2016-03-02 00:13:47 +00:00
type_test.go