Performance optimizations

This commit is contained in:
Christian Kratky
2017-11-25 23:10:48 +01:00
parent 24ab285066
commit 611fabcd01
11 changed files with 105 additions and 88 deletions
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using MQTTnet.Protocol;
@@ -56,11 +55,11 @@ namespace MQTTnet.Serializer
Write(value);
}
public static void WriteRemainingLength(int length, List<byte> target)
public static void WriteRemainingLength(int length, BinaryWriter target)
{
if (length == 0)
{
target.Add(0);
target.Write((byte)0);
return;
}
@@ -75,7 +74,7 @@ namespace MQTTnet.Serializer
encodedByte = encodedByte | 128;
}
target.Add((byte)encodedByte);
target.Write((byte)encodedByte);
} while (x > 0);
}
}