DeflateStream buffer reuse #18928
Labels
area-System.IO.Compression
enhancement
Product code improvement that does NOT require public API changes/additions
tenet-performance
Performance related issue
Milestone
The
DeflateStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen)
constructor allocates an 8KBbyte[]
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.
The text was updated successfully, but these errors were encountered: