go/src/encoding
korzhao dcf3545774 encoding/gob: optimize decoding of slice
In CL 345572, we used the reflect.Value.SetLen method to avoid
extra memory allocation for reflect.Value.Slice.
This also applies to function decodeSlice

name                   old time/op    new time/op    delta
DecodeStringsSlice-12    96.5µs ±12%    63.0µs ± 8%  -34.68%  (p=0.000 n=9+10)

name                   old alloc/op   new alloc/op   delta
DecodeStringsSlice-12    89.3kB ± 0%    65.3kB ± 0%  -26.89%  (p=0.000 n=10+10)

name                   old allocs/op  new allocs/op  delta
DecodeStringsSlice-12     3.18k ± 0%     2.18k ± 0%  -31.47%  (p=0.000 n=10+10)

Change-Id: Ifdb43716cc90a265962dec022704a5571f447fd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/347533
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Rob Pike <r@golang.org>
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-07 21:39:06 +00:00
..
ascii85 all: update references to symbols moved from io/ioutil to io 2020-10-20 18:41:18 +00:00
asn1 all: remove redundant spaces before . and , 2021-04-20 00:49:17 +00:00
base32 all: update references to symbols moved from io/ioutil to io 2020-10-20 18:41:18 +00:00
base64 all: update references to symbols moved from io/ioutil to io 2020-10-20 18:41:18 +00:00
binary encoding/binary: limit bytes read by Uvarint to <= 10 2021-03-08 18:49:14 +00:00
csv encoding/csv: add FieldPos method 2021-04-29 17:47:48 +00:00
gob encoding/gob: optimize decoding of slice 2021-09-07 21:39:06 +00:00
hex all: update references to symbols moved from io/ioutil to io 2020-10-20 18:41:18 +00:00
json encoding/json: fix package shadowing in MarshalIndent example 2021-03-14 19:58:14 +00:00
pem all: update references to symbols moved from io/ioutil to io 2020-10-20 18:41:18 +00:00
xml encoding/xml: replace comments inside directives with a space 2021-03-15 20:04:23 +00:00
encoding.go