Use spans to improve performance in StreamExts.
Also avoid ReadBytes calls that allocate a buffer by either updating the stream position (if not interested in the bytes), by reusing an input buffer (if interested in the bytes), or using a stackalloc buffer to avoid the allocation (for small reads).
This commit is contained in:
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.FileSystem
|
||||
var dirName = s.ReadASCII(nameLength);
|
||||
|
||||
// Skip to the end of the chunk
|
||||
s.ReadBytes(chunkSize - nameLength - 6);
|
||||
s.Position += chunkSize - nameLength - 6;
|
||||
directories.Add(dirName, fileCount);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user