From 7cc5c537a42634c13e45705799098da06bc79a6c Mon Sep 17 00:00:00 2001 From: Krzysztof Cwalina Date: Thu, 2 Mar 2017 08:41:44 -0800 Subject: [PATCH] Added a new benchmark --- .../RequestParsing.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs index 9d91d8e681..7dffa9c1f4 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.Performance/RequestParsing.cs @@ -23,6 +23,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance private const string plaintextRequest = "GET /plaintext HTTP/1.1\r\nHost: www.example.com\r\n\r\n"; + private const string plaintextTechEmpower = "GET /plaintext HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "Accept: text/plain,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7\r\n" + + "Connection: keep-alive\r\n\r\n"; + private const string liveaspnetRequest = "GET https://live.asp.net/ HTTP/1.1\r\n" + "Host: live.asp.net\r\n" + "Connection: keep-alive\r\n" + @@ -51,7 +56,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance private static readonly byte[] _plaintextPipelinedRequests = Encoding.ASCII.GetBytes(string.Concat(Enumerable.Repeat(plaintextRequest, Pipelining))); private static readonly byte[] _plaintextRequest = Encoding.ASCII.GetBytes(plaintextRequest); - + private static readonly byte[] _plaintextTechEmpower = Encoding.ASCII.GetBytes(plaintextTechEmpower); + private static readonly byte[] _liveaspnentPipelinedRequests = Encoding.ASCII.GetBytes(string.Concat(Enumerable.Repeat(liveaspnetRequest, Pipelining))); private static readonly byte[] _liveaspnentRequest = Encoding.ASCII.GetBytes(liveaspnetRequest); @@ -71,6 +77,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance } } + [Benchmark(OperationsPerInvoke = InnerLoopCount)] + public void ParsePlaintextTechEmpower() + { + for (var i = 0; i < InnerLoopCount; i++) { + InsertData(_plaintextTechEmpower); + ParseData(); + } + } + [Benchmark(OperationsPerInvoke = InnerLoopCount * Pipelining)] public void ParsePipelinedPlaintext() {