icsharpcode / SharpZipLib

#ziplib is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.
http://icsharpcode.github.io/SharpZipLib/
MIT License
3.7k stars 976 forks source link

Perf - Add buffer pooling where relevant #832

Open thibault-reigner opened 1 year ago

thibault-reigner commented 1 year ago

Current situation

Some pieces of code such as InflaterInputStream, through InflaterInputStream, allocate buffers upfront in their constructors, with no way to control this behavior (e.g : passing the buffer to use). In code making intensive use of such classes (e.g : app sending huge amounts of compressed data in my case), this can result in this being unsustainable in term of resulting GC load.

Describe the solution you'd like

I would like to suggest some alternatives :

Describe alternatives you've considered

Due to current design of most classes there is sadly no alternative as there is no control over the buffers allocations in constructors.

Tags

Performance