diff options
author | Joe Tsai <joetsai@digital-static.net> | 2021-08-26 20:26:32 -0700 |
---|---|---|
committer | Joe Tsai <joetsai@digital-static.net> | 2021-08-27 08:01:41 +0000 |
commit | 67f7e16bcce0a3e68bf92e233ea16c8a9d2ac07a (patch) | |
tree | b0f76651404446665969e3d7ad6ccf8c1234111f /lib/time | |
parent | 2c60a99f723e779a39664b5f12cb41878fd4a700 (diff) | |
download | go-67f7e16bcce0a3e68bf92e233ea16c8a9d2ac07a.tar.gz go-67f7e16bcce0a3e68bf92e233ea16c8a9d2ac07a.zip |
encoding/gob: optimize decoding of []byte
The reflect.Value.Slice method unfortunately allocates every time
since it needs to place the slice header on the heap.
This is silly since gob immediately stores the result back into slice.
Instead, use the reflect.Value.SetLen method.
DecodeBytesSlice 75.0µs ± 2% 35.2µs ± 6% -53.02%
Change-Id: I3ca0529d01bf978f2b76e215f52d369f458951ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/345572
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'lib/time')
0 files changed, 0 insertions, 0 deletions