]> Cypherpunks repositories - gostls13.git/commit
archive/zip: re-use flate.Writers when writing compressed files
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 11 Feb 2014 19:41:25 +0000 (11:41 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 11 Feb 2014 19:41:25 +0000 (11:41 -0800)
commit517f4a96837e345609aca6f5bdf1fbeb92c70647
tree9fd5085032a2a9a4be4cf1a6293986783d5fef2c
parente5a4211b36ca776189730de6f1ab4403dde46f46
archive/zip: re-use flate.Writers when writing compressed files

Prevents a ton of garbage. (Noticed this when writing large
Camlistore zip archives to Amazon Glacier)

Note that the Closer part of the io.WriteCloser is never given
to users. It's an internal detail of the package.

benchmark                         old ns/op     new ns/op     delta
BenchmarkCompressedZipGarbage     42884123      40732373      -5.02%

benchmark                         old allocs     new allocs     delta
BenchmarkCompressedZipGarbage     204            149            -26.96%

benchmark                         old bytes     new bytes     delta
BenchmarkCompressedZipGarbage     4397576       66744         -98.48%

LGTM=adg, rsc
R=adg, rsc
CC=golang-codereviews
https://golang.org/cl/54300053
src/pkg/archive/zip/register.go