• Hiroshi Ioka's avatar
    encoding/asn1: reduce allocations in Marshal · ae4aac00
    Hiroshi Ioka authored
    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/27030Reviewed-by: 's avatarAdam Langley <agl@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Adam Langley <agl@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    ae4aac00
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...