Skip to content

simonholt/ArrayPoolMemoryStream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ArrayPoolMemoryStream

An experimental replacement for MemoryStream using ArrayPool

This is not production-quality code, and is only used for benchmarking purposes!

Lots of serializers use code of this form:

using (var ms = new MemoryStream())
{
   mySerializer(myObject, ms);
   return ms.ToArray();   
}

This can lead to a lot of intermediate garbage being generated if the object is large.

With the introduction of ArrayPool in System.Buffers, I thought I'd knock together a MemoryStream implementation to see how it compares.

There is a fully-implemented version here:

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

However, this uses its own pool rather than System.Buffers.ArrayPool.

About

Experimental replacement for MemoryStream using ArrayPool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages