Provide a 'fast' constructor for MemoryStream and avoid the expensive StreamHelper.ToByteArray call.
With the MemoryStream you can save 50% of the managed memory usage if you don't copy the byte-buffer.
Something like that:
```
public void Read(Stream stream, MagickReadSettings readSettings)
{
Throw.IfNull("stream", stream);
if( stream.GetType() != typeof(System.IO.MemoryStream) )
{
this.Read(StreamHelper.ToByteArray(stream), readSettings);
return;
}
byte[] data = MemoryStream.GetBuffer();
int length = MemoryStream.Length;
this.Read(data, length, readSettings);
}
```
So people are able to use some kind of buffer pooling or else without the penalty of creating byte arrays only for the Read() call.
With the MemoryStream you can save 50% of the managed memory usage if you don't copy the byte-buffer.
Something like that:
```
public void Read(Stream stream, MagickReadSettings readSettings)
{
Throw.IfNull("stream", stream);
if( stream.GetType() != typeof(System.IO.MemoryStream) )
{
this.Read(StreamHelper.ToByteArray(stream), readSettings);
return;
}
byte[] data = MemoryStream.GetBuffer();
int length = MemoryStream.Length;
this.Read(data, length, readSettings);
}
```
So people are able to use some kind of buffer pooling or else without the penalty of creating byte arrays only for the Read() call.