go/src/encoding
Josh Bleecher Snyder b85433975a encoding/binary: use an offset instead of slicing
While running make.bash, over 5% of all pointer writes
come from encoding/binary doing struct reads.

This change replaces slicing during such reads with an offset.
This avoids updating the slice pointer with every
struct field read or write.

This has no impact when the write barrier is off.
Running the benchmarks with GOGC=1, however,
shows significant improvement:

name          old time/op    new time/op    delta
ReadStruct-8    13.2µs ± 6%    10.1µs ± 5%  -23.24%  (p=0.000 n=10+10)

name          old speed      new speed      delta
ReadStruct-8  5.69MB/s ± 6%  7.40MB/s ± 5%  +30.18%  (p=0.000 n=10+10)

Change-Id: I22904263196bfeddc38abe8989428e263aee5253
Reviewed-on: https://go-review.googlesource.com/98757
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-06 18:59:03 +00:00
..
ascii85 encoding/ascii85: make bigtest big again 2017-06-23 14:28:30 +00:00
asn1 encoding/asn1: allow '&' in PrintableString fields 2017-12-05 18:22:53 +00:00
base32 Revert "go/printer: forbid empty line before first comment in block" 2017-12-01 01:12:26 +00:00
base64 encoding/base64: optimize DecodeString 2017-10-09 15:39:51 +00:00
binary encoding/binary: use an offset instead of slicing 2018-03-06 18:59:03 +00:00
csv encoding/csv: truncate carriage returns at EOF 2017-12-05 18:44:31 +00:00
gob encoding/gob: avoid race on idToType 2018-01-04 02:17:33 +00:00
hex encoding/hex: fix potential incorrect Dumper output when Close is called multiple times 2018-02-14 03:25:25 +00:00
json encoding/json: apply conventional error handling in decoder 2018-03-03 17:16:47 +00:00
pem encoding/pem: change Encode, EncodeToMemory not to generate partial PEM blocks 2017-12-06 03:59:41 +00:00
xml all: remove duplicate word "the" 2018-02-20 16:45:55 +00:00
encoding.go