Adds back in old benchmarks. Cleans up tests. (#270)

This commit is contained in:
Kamron Batman 2020-10-04 11:45:07 -07:00 committed by GitHub
parent 09d80916b8
commit 4e799ddbd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 498 additions and 160 deletions

View file

@ -0,0 +1,27 @@
using System;
using System.Buffers.Binary;
using System.Runtime.CompilerServices;
using Server;
namespace Benchmarks
{
public static class PacketTestUtilities
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Write(this Span<byte> data, ref int pos, Serial serial)
{
BinaryPrimitives.WriteUInt32BigEndian(data.Slice(pos, 4), serial);
pos += 4;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Write(this Span<byte> data, ref int pos, ushort value)
{
BinaryPrimitives.WriteUInt16BigEndian(data.Slice(pos, 2), value);
pos += 2;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Write(this Span<byte> data, ref int pos, byte value) => data[pos++] = value;
}
}