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

DeflateStream buffer reuse #18928

Closed
Tratcher opened this issue Oct 11, 2016 · 2 comments
Closed

DeflateStream buffer reuse #18928

Tratcher opened this issue Oct 11, 2016 · 2 comments
Assignees
Labels
area-System.IO.Compression enhancement Product code improvement that does NOT require public API changes/additions tenet-performance Performance related issue
Milestone

Comments

@Tratcher
Copy link
Member

The DeflateStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) constructor allocates an 8KB byte[] buffer for each instance. ASP.NET Core has response compression middleware that needs a new stream per response, so this memory allocation adds up very quickly.

Possible improvements:
A) Internally pooling the buffers
B) Allowing the buffer to be provided in the constructor so the caller can pool.

Note any API changes would need to be exposed on the GZipStream wrapper as well.

@davidfowl
Copy link
Member

Related #18488
/cc @stephentoub

@karelz
Copy link
Member

karelz commented Oct 12, 2016

@ianhays can you take a look?

@stephentoub stephentoub self-assigned this Nov 17, 2016
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO.Compression enhancement Product code improvement that does NOT require public API changes/additions tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

5 participants