go/src/encoding
Hiroshi Ioka ae4aac00bb encoding/asn1: reduce allocations in Marshal
Current code uses trees of bytes.Buffer as data representation.
Each bytes.Buffer takes 4k bytes at least, so it's waste of memory.
The change introduces trees of lazy-encoder as
alternative one which reduce allocations.

name       old time/op    new time/op    delta
Marshal-4    64.7µs ± 2%    42.0µs ± 1%  -35.07%   (p=0.000 n=9+10)

name       old alloc/op   new alloc/op   delta
Marshal-4    35.1kB ± 0%     7.6kB ± 0%  -78.27%  (p=0.000 n=10+10)

name       old allocs/op  new allocs/op  delta
Marshal-4       503 ± 0%       293 ± 0%  -41.75%  (p=0.000 n=10+10)

Change-Id: I32b96c20b8df00414b282d69743d71a598a11336
Reviewed-on: https://go-review.googlesource.com/27030
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-13 21:05:27 +00:00
..
ascii85 all: single space after period. 2016-03-02 00:13:47 +00:00
asn1 encoding/asn1: reduce allocations in Marshal 2016-09-13 21:05:27 +00:00
base32 all: single space after period. 2016-03-02 00:13:47 +00:00
base64 encoding/base64: correct DecodedLen overestimate for unpadded encodings 2016-03-15 20:43:04 +00:00
binary all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
csv encoding/csv: update doc about comments whitespace 2016-06-10 01:00:09 +00:00
gob encoding/gob: error out instead of panicking on nil dereference 2016-08-19 21:54:39 +00:00
hex encoding/hex: fix example function name 2016-09-10 21:40:16 +00:00
json encoding/json: Use a lookup table for safe characters 2016-09-08 18:02:34 +00:00
pem encoding/pem: be stricter about the ending line. 2016-08-19 16:29:44 +00:00
xml encoding/xml: do not ignore error return from copyValue 2016-08-22 18:01:47 +00:00
encoding.go