• Rob Pike's avatar
    encoding/gob: reduce decoder memory · 37519d95
    Rob Pike authored
    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
    37519d95
decoder.go 6.77 KB