NetworkReaderTest: stopwatch not needed, Unity already shows the time

This commit is contained in:
vis2k 2020-01-23 15:56:16 +01:00
parent 2f7a67e3f9
commit 84fc240d00

View File

@ -16,18 +16,14 @@ public class NetworkReaderTest
public void Benchmark()
{
// 10 million reads, Unity 2019.3, code coverage disabled
// 4096ms (+GC later)
// 4049ms (+GC later)
byte[] bytes = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C};
Stopwatch watch = new Stopwatch();
watch.Start();
for (int i = 0; i < 10000000; ++i)
{
ArraySegment<byte> segment = new ArraySegment<byte>(bytes);
NetworkReader reader = new NetworkReader(segment);
Vector3 value = reader.ReadVector3();
}
watch.Stop();
Debug.Log("NetworkReaderTest Benchmark: " + watch.ElapsedMilliseconds + " ms");
}
[Test]