agnicore / nfx

.NET Standard Unistack Framework
http://nfxlib.com
Other
75 stars 91 forks source link

Revise MemoryStream use cases - consider something like RecyclableMemoryStream or base it on Pile #21

Open itadapter opened 6 years ago

itadapter commented 6 years ago

MemoryStream allocates arrays in LOH, and it is inefficient. Along the lines what MSFT did with RecyclablememoryStream, we could use Pile as memory manager or use RecyclableMemoryStream by MSFT as a drop-in replacement.

This deals with perf critical code where MemoryStream gets allocated/released many times. See:

https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream

The design needs to be re-evaluated in the light of: Pile, and ArrayPool/ Memory no to create code duplication