]> Cypherpunks repositories - gostls13.git/commit
encoding/gob: reduce decoder memory
authorRob Pike <r@golang.org>
Fri, 13 Jul 2012 03:53:17 +0000 (20:53 -0700)
committerRob Pike <r@golang.org>
Fri, 13 Jul 2012 03:53:17 +0000 (20:53 -0700)
commit37519d950d24a466ea96d7a65164ceaab17a40e0
tree4733ab18505b30def3445d075637ba4128f13a1f
parent1255a6302d83148d41f78b7c7b49cacad8139bdc
encoding/gob: reduce decoder memory
Gob decoding reads a whole message into memory and then
copies it into a bytes.Buffer. For large messages this wastes
an entire copy of the message. In this CL, we use a staging
buffer to avoid the large temporary.

Update #2539
RSS drops to 775MB from 1GB.
Active memory drops to 858317048 from 1027878136,
essentially the size of one copy of the input file.

R=dsymonds, nigeltao
CC=golang-dev
https://golang.org/cl/6392057
src/pkg/encoding/gob/decoder.go