address PR feedback

This commit is contained in:
arespr 2017-03-02 22:14:36 +01:00
parent bb74a6ce34
commit 346d8eaa03
2 changed files with 24 additions and 33 deletions

View File

@ -21,8 +21,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
static byte[] _methodOptions = Encoding.ASCII.GetBytes("OPTIONS ");
static byte[] _methodTrace = Encoding.ASCII.GetBytes("TRACE \0\0");
static byte[] _version = Encoding.UTF8.GetBytes("HTTP/1.1\r\n");
const int loops = 1000;
@ -95,7 +93,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
return GetKnownMethod(data);
}
private int GetKnownMethod(Span<byte> data)
{
int len = 0;
@ -127,7 +124,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
return len;
}
[Benchmark(OperationsPerInvoke = loops * 10)]
public int GetKnownVersion_HTTP1_1()
{

View File

@ -23,7 +23,6 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
static byte[] _methodOptions = Encoding.ASCII.GetBytes("OPTIONS ");
static byte[] _methodTrace = Encoding.ASCII.GetBytes("TRACE \0\0");
const int MagicNumer = 0x0600000C;
static byte[] _invalidMethod1 = BitConverter.GetBytes((ulong)MagicNumer);
static byte[] _invalidMethod2 = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@ -38,16 +37,13 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
static byte[] _invalidMethod11 = Encoding.ASCII.GetBytes("OPTIONS_");
static byte[] _invalidMethod12 = Encoding.ASCII.GetBytes("TRACE_\0\0");
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static object[] CreateTestDataEntry(byte[] methodData, HttpMethod expectedMethod, int expectedLength, bool expectedResult)
{
return new object[] { methodData, expectedMethod, expectedLength, expectedResult };
}
private static readonly List<object[]> _testData
= new List<object[]>
private static readonly object[][] _testData = new object[][]
{
CreateTestDataEntry(_methodGet, HttpMethod.Get, 3, true),
CreateTestDataEntry(_methodPut, HttpMethod.Put, 3, true),
@ -74,7 +70,6 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
public static IEnumerable<object[]> TestData => _testData;
[Theory]
[MemberData(nameof(TestData), MemberType = typeof(KnownStringsTests))]
public void GetsKnownMethod(byte[] methodData, HttpMethod expectedMethod, int expectedLength, bool expectedResult)