Skip to content

Add sync.Pool to gzip middleware #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 13, 2015
Merged

Add sync.Pool to gzip middleware #200

merged 2 commits into from
Sep 13, 2015

Conversation

tylerstillwater
Copy link
Contributor

Using a sync.Pool and the gzip.Writer.Reset method, we are able to reduce allocations, memory usage, cpu time and gc time. Benchmark below:

benchmark         old ns/op     new ns/op     delta
BenchmarkGzip     321829        94806         -70.54%

benchmark         old allocs     new allocs     delta
BenchmarkGzip     79             58             -26.58%

benchmark         old bytes     new bytes     delta
BenchmarkGzip     1459072       8065          -99.45%

vishr added a commit that referenced this pull request Sep 13, 2015
Add sync.Pool to gzip middleware
@vishr vishr merged commit f27440f into labstack:master Sep 13, 2015
@vishr
Copy link
Member

vishr commented Sep 13, 2015

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants