add micro benchmark for parsing Json TechEmpower request (#20505)
This commit is contained in:
parent
e75ff49869
commit
54b4a0ffa2
|
|
@ -26,6 +26,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Benchmark(OperationsPerInvoke = RequestParsingData.InnerLoopCount)]
|
||||||
|
public void JsonTechEmpower()
|
||||||
|
{
|
||||||
|
for (var i = 0; i < RequestParsingData.InnerLoopCount; i++)
|
||||||
|
{
|
||||||
|
InsertData(RequestParsingData.JsonTechEmpowerRequest);
|
||||||
|
ParseData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Benchmark(OperationsPerInvoke = RequestParsingData.InnerLoopCount)]
|
[Benchmark(OperationsPerInvoke = RequestParsingData.InnerLoopCount)]
|
||||||
public void LiveAspNet()
|
public void LiveAspNet()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -19,6 +19,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
"Connection: keep-alive\r\n" +
|
"Connection: keep-alive\r\n" +
|
||||||
"\r\n";
|
"\r\n";
|
||||||
|
|
||||||
|
private const string _jsonTechEmpowerRequest =
|
||||||
|
"GET /json HTTP/1.1\r\n" +
|
||||||
|
"Host: localhost\r\n" +
|
||||||
|
"Accept: Accept:application/json,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";
|
||||||
|
|
||||||
// edge-casey - client's don't normally send this
|
// edge-casey - client's don't normally send this
|
||||||
private const string _plaintextAbsoluteUriRequest =
|
private const string _plaintextAbsoluteUriRequest =
|
||||||
"GET http://localhost/plaintext HTTP/1.1\r\n" +
|
"GET http://localhost/plaintext HTTP/1.1\r\n" +
|
||||||
|
|
@ -59,6 +66,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
public static readonly byte[] PlaintextTechEmpowerPipelinedRequests = Encoding.ASCII.GetBytes(string.Concat(Enumerable.Repeat(_plaintextTechEmpowerRequest, Pipelining)));
|
public static readonly byte[] PlaintextTechEmpowerPipelinedRequests = Encoding.ASCII.GetBytes(string.Concat(Enumerable.Repeat(_plaintextTechEmpowerRequest, Pipelining)));
|
||||||
public static readonly byte[] PlaintextTechEmpowerRequest = Encoding.ASCII.GetBytes(_plaintextTechEmpowerRequest);
|
public static readonly byte[] PlaintextTechEmpowerRequest = Encoding.ASCII.GetBytes(_plaintextTechEmpowerRequest);
|
||||||
|
|
||||||
|
public static readonly byte[] JsonTechEmpowerRequest = Encoding.ASCII.GetBytes(_jsonTechEmpowerRequest);
|
||||||
|
|
||||||
public static readonly byte[] PlaintextAbsoluteUriRequest = Encoding.ASCII.GetBytes(_plaintextAbsoluteUriRequest);
|
public static readonly byte[] PlaintextAbsoluteUriRequest = Encoding.ASCII.GetBytes(_plaintextAbsoluteUriRequest);
|
||||||
|
|
||||||
public static readonly byte[] LiveaspnetPipelinedRequests = Encoding.ASCII.GetBytes(string.Concat(Enumerable.Repeat(_liveaspnetRequest, Pipelining)));
|
public static readonly byte[] LiveaspnetPipelinedRequests = Encoding.ASCII.GetBytes(string.Concat(Enumerable.Repeat(_liveaspnetRequest, Pipelining)));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue