Consecutive calls to DataStream.WriteTo were allocating arrays upto 70 KB each time. When the number of calls is big, this could cause an unnecessary performance issues, especially impacting the memory.
For instance, in Ekona generating some ROMs with a lot of files, due to the WriteTo we required 256 MB in the RAM.
Now, we reuse arrays between calls with the library System.Buffers. The memory was reduced to 70 MB in the same test.
Description
Consecutive calls to
DataStream.WriteTo
were allocating arrays upto 70 KB each time. When the number of calls is big, this could cause an unnecessary performance issues, especially impacting the memory. For instance, in Ekona generating some ROMs with a lot of files, due to theWriteTo
we required 256 MB in the RAM. Now, we reuse arrays between calls with the librarySystem.Buffers
. The memory was reduced to 70 MB in the same test.Example
Internal improvement, API is the same.