Skip to content
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

Consider only compressing larger than minimum bytes #3

Open
shelakel opened this issue Mar 9, 2014 · 4 comments
Open

Consider only compressing larger than minimum bytes #3

shelakel opened this issue Mar 9, 2014 · 4 comments

Comments

@shelakel
Copy link

shelakel commented Mar 9, 2014

Consider using a buffer for the response and only doing the GZIP compression at the end when the amount of bytes to be written exceeds a threshold. See:

http://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits

@haoxins
Copy link

haoxins commented May 29, 2014

@slogsdon
Copy link
Member

slogsdon commented Jun 6, 2014

@shelakel @coderhaoxin Sorry for the delay! I'm hoping to tackle this soon (like this weekend if possible).

@13k
Copy link

13k commented Oct 3, 2014

👍

I came here because the middleware is compressing empty body responses (as in header-only responses). This doesn't seem to be right, though, since the Content-Length for an empty body is obviously zero and a compressed empty response has the gzip header overhead (looks like 23 bytes).

@13k
Copy link

13k commented Oct 3, 2014

Also in the case of zero-length compressed responses, it forces the client to actually decompress the response body (which will then be empty), consuming unnecessary processing time.

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

No branches or pull requests

4 participants