OrderIO performance improvement

OrderIO, ToOrderList, skip if frame is empty,
which occurs often each client each frame.
This commit is contained in:
Vapre
2021-01-05 00:08:04 +01:00
committed by abcdefg30
parent 44b2dda585
commit fc49d6943a

View File

@@ -16,8 +16,14 @@ namespace OpenRA.Network
{
public static class OrderIO
{
static readonly List<Order> EmptyOrderList = new List<Order>(0);
public static List<Order> ToOrderList(this byte[] bytes, World world)
{
// PERF: Skip empty order frames, often per client each frame
if (bytes.Length == 4)
return EmptyOrderList;
var ms = new MemoryStream(bytes, 4, bytes.Length - 4);
var reader = new BinaryReader(ms);
var ret = new List<Order>();