Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(56)

Issue 54300053: code review 54300053: archive/zip: re-use flate.Writers when writing compress... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 4 months ago by bradfitz
Modified:
11 years, 4 months ago
Reviewers:
adg, rsc
CC:
adg, rsc, golang-codereviews
Visibility:
Public.

Description

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%

Patch Set 1 #

Patch Set 2 : diff -r 8109f20c33fd https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 8109f20c33fd https://go.googlecode.com/hg/ #

Total comments: 3

Patch Set 4 : diff -r c3ee11c5f19f https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -1 line) Patch
M src/pkg/archive/zip/register.go View 1 2 chunks +40 lines, -1 line 0 comments Download

Messages

Total messages: 6
bradfitz
Hello adg@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 4 months ago (2014-02-08 01:07:08 UTC) #1
adg
https://codereview.appspot.com/54300053/diff/40001/src/pkg/archive/zip/register.go File src/pkg/archive/zip/register.go (right): https://codereview.appspot.com/54300053/diff/40001/src/pkg/archive/zip/register.go#newcode28 src/pkg/archive/zip/register.go:28: fw, ok := flateWriterPool.Get().(*flate.Writer) I didn't realize how nicely ...
11 years, 4 months ago (2014-02-09 21:58:38 UTC) #2
bradfitz
https://codereview.appspot.com/54300053/diff/40001/src/pkg/archive/zip/register.go File src/pkg/archive/zip/register.go (right): https://codereview.appspot.com/54300053/diff/40001/src/pkg/archive/zip/register.go#newcode37 src/pkg/archive/zip/register.go:37: type pooledFlateWriter struct { On 2014/02/09 21:58:39, adg wrote: ...
11 years, 4 months ago (2014-02-09 22:09:31 UTC) #3
adg
LGTM On 2014/02/09 22:09:31, bradfitz wrote: > https://codereview.appspot.com/54300053/diff/40001/src/pkg/archive/zip/register.go > File src/pkg/archive/zip/register.go (right): > > https://codereview.appspot.com/54300053/diff/40001/src/pkg/archive/zip/register.go#newcode37 ...
11 years, 4 months ago (2014-02-09 22:11:51 UTC) #4
rsc
LGTM I wish we could do better but the flate API + Go 1 compatibility ...
11 years, 4 months ago (2014-02-11 19:34:25 UTC) #5
bradfitz
11 years, 4 months ago (2014-02-11 19:41:30 UTC) #6
*** Submitted as https://code.google.com/p/go/source/detail?r=2b0968d47633 ***

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://codereview.appspot.com/54300053
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b