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:
@@ -64,7 +64,7 @@ namespace OpenRA.Server
|
||||
ms.Write(0);
|
||||
ms.Write(0);
|
||||
ms.WriteByte((byte)OrderType.Ping);
|
||||
ms.WriteArray(BitConverter.GetBytes(Game.RunTime));
|
||||
ms.Write(Game.RunTime);
|
||||
return ms.GetBuffer();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user