From e7cc0d33af55c60ca386f774ab30dfdab2305c73 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 22 Dec 2017 09:51:26 -0800 Subject: [PATCH] Use common BDN config (#2233) --- .../Kestrel.Performance/AssemblyInfo.cs | 1 + .../DotSegmentRemovalBenchmark.cs | 1 - ...Http1ConnectionParsingOverheadBenchmark.cs | 1 - .../Http1WritingBenchmark.cs | 1 - .../HttpParserBenchmark.cs | 2 -- .../HttpProtocolFeatureCollection.cs | 1 - .../KnownStringsBenchmark.cs | 1 - .../PipeThroughputBenchmark.cs | 1 - .../RequestParsingBenchmark.cs | 1 - .../ResponseHeaderCollectionBenchmark.cs | 1 - .../ResponseHeadersWritingBenchmark.cs | 1 - .../StringUtilitiesBenchmark.cs | 1 - .../Kestrel.Performance/configs/CoreConfig.cs | 36 ------------------- 13 files changed, 1 insertion(+), 48 deletions(-) create mode 100644 benchmarks/Kestrel.Performance/AssemblyInfo.cs delete mode 100644 benchmarks/Kestrel.Performance/configs/CoreConfig.cs diff --git a/benchmarks/Kestrel.Performance/AssemblyInfo.cs b/benchmarks/Kestrel.Performance/AssemblyInfo.cs new file mode 100644 index 0000000000..32248e0d1b --- /dev/null +++ b/benchmarks/Kestrel.Performance/AssemblyInfo.cs @@ -0,0 +1 @@ +[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark] diff --git a/benchmarks/Kestrel.Performance/DotSegmentRemovalBenchmark.cs b/benchmarks/Kestrel.Performance/DotSegmentRemovalBenchmark.cs index caa43f2b58..79389d4a33 100644 --- a/benchmarks/Kestrel.Performance/DotSegmentRemovalBenchmark.cs +++ b/benchmarks/Kestrel.Performance/DotSegmentRemovalBenchmark.cs @@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class DotSegmentRemovalBenchmark { // Immutable diff --git a/benchmarks/Kestrel.Performance/Http1ConnectionParsingOverheadBenchmark.cs b/benchmarks/Kestrel.Performance/Http1ConnectionParsingOverheadBenchmark.cs index 5b2af1d52a..4747c696ee 100644 --- a/benchmarks/Kestrel.Performance/Http1ConnectionParsingOverheadBenchmark.cs +++ b/benchmarks/Kestrel.Performance/Http1ConnectionParsingOverheadBenchmark.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Performance.Mocks; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class Http1ConnectionParsingOverheadBenchmark { private const int InnerLoopCount = 512; diff --git a/benchmarks/Kestrel.Performance/Http1WritingBenchmark.cs b/benchmarks/Kestrel.Performance/Http1WritingBenchmark.cs index fcc3f86bc4..3904523c02 100644 --- a/benchmarks/Kestrel.Performance/Http1WritingBenchmark.cs +++ b/benchmarks/Kestrel.Performance/Http1WritingBenchmark.cs @@ -16,7 +16,6 @@ using Microsoft.AspNetCore.Testing; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class Http1WritingBenchmark { // Standard completed task diff --git a/benchmarks/Kestrel.Performance/HttpParserBenchmark.cs b/benchmarks/Kestrel.Performance/HttpParserBenchmark.cs index 0bf1a6fca4..429dc358e7 100644 --- a/benchmarks/Kestrel.Performance/HttpParserBenchmark.cs +++ b/benchmarks/Kestrel.Performance/HttpParserBenchmark.cs @@ -8,8 +8,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] - public class HttpParserBenchmark : IHttpRequestLineHandler, IHttpHeadersHandler { private readonly HttpParser _parser = new HttpParser(); diff --git a/benchmarks/Kestrel.Performance/HttpProtocolFeatureCollection.cs b/benchmarks/Kestrel.Performance/HttpProtocolFeatureCollection.cs index b5ebc8531e..23d9c80d3b 100644 --- a/benchmarks/Kestrel.Performance/HttpProtocolFeatureCollection.cs +++ b/benchmarks/Kestrel.Performance/HttpProtocolFeatureCollection.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class HttpProtocolFeatureCollection { private readonly Http1Connection _http1Connection; diff --git a/benchmarks/Kestrel.Performance/KnownStringsBenchmark.cs b/benchmarks/Kestrel.Performance/KnownStringsBenchmark.cs index 095d568360..69bf2d5adb 100644 --- a/benchmarks/Kestrel.Performance/KnownStringsBenchmark.cs +++ b/benchmarks/Kestrel.Performance/KnownStringsBenchmark.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class KnownStringsBenchmark { static byte[] _methodConnect = Encoding.ASCII.GetBytes("CONNECT "); diff --git a/benchmarks/Kestrel.Performance/PipeThroughputBenchmark.cs b/benchmarks/Kestrel.Performance/PipeThroughputBenchmark.cs index 92b04887f3..999fa0a8e1 100644 --- a/benchmarks/Kestrel.Performance/PipeThroughputBenchmark.cs +++ b/benchmarks/Kestrel.Performance/PipeThroughputBenchmark.cs @@ -8,7 +8,6 @@ using BenchmarkDotNet.Attributes; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class PipeThroughputBenchmark { private const int _writeLenght = 57; diff --git a/benchmarks/Kestrel.Performance/RequestParsingBenchmark.cs b/benchmarks/Kestrel.Performance/RequestParsingBenchmark.cs index c7b74bf7d5..7762902258 100644 --- a/benchmarks/Kestrel.Performance/RequestParsingBenchmark.cs +++ b/benchmarks/Kestrel.Performance/RequestParsingBenchmark.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Performance.Mocks; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class RequestParsingBenchmark { public IPipe Pipe { get; set; } diff --git a/benchmarks/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs b/benchmarks/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs index 1e49ec53f2..8f722aaba5 100644 --- a/benchmarks/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs +++ b/benchmarks/Kestrel.Performance/ResponseHeaderCollectionBenchmark.cs @@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class ResponseHeaderCollectionBenchmark { private const int InnerLoopCount = 512; diff --git a/benchmarks/Kestrel.Performance/ResponseHeadersWritingBenchmark.cs b/benchmarks/Kestrel.Performance/ResponseHeadersWritingBenchmark.cs index 024fd1ae1c..9c807620e4 100644 --- a/benchmarks/Kestrel.Performance/ResponseHeadersWritingBenchmark.cs +++ b/benchmarks/Kestrel.Performance/ResponseHeadersWritingBenchmark.cs @@ -17,7 +17,6 @@ using Microsoft.AspNetCore.Testing; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class ResponseHeadersWritingBenchmark { private static readonly byte[] _helloWorldPayload = Encoding.ASCII.GetBytes("Hello, World!"); diff --git a/benchmarks/Kestrel.Performance/StringUtilitiesBenchmark.cs b/benchmarks/Kestrel.Performance/StringUtilitiesBenchmark.cs index 3d1b8aee01..e2b2e9eab1 100644 --- a/benchmarks/Kestrel.Performance/StringUtilitiesBenchmark.cs +++ b/benchmarks/Kestrel.Performance/StringUtilitiesBenchmark.cs @@ -6,7 +6,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; namespace Microsoft.AspNetCore.Server.Kestrel.Performance { - [ParameterizedJobConfig(typeof(CoreConfig))] public class StringUtilitiesBenchmark { private const int Iterations = 500_000; diff --git a/benchmarks/Kestrel.Performance/configs/CoreConfig.cs b/benchmarks/Kestrel.Performance/configs/CoreConfig.cs deleted file mode 100644 index 98f1ab03fd..0000000000 --- a/benchmarks/Kestrel.Performance/configs/CoreConfig.cs +++ /dev/null @@ -1,36 +0,0 @@ -// 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. - -using BenchmarkDotNet.Columns; -using BenchmarkDotNet.Configs; -using BenchmarkDotNet.Diagnosers; -using BenchmarkDotNet.Engines; -using BenchmarkDotNet.Jobs; -using BenchmarkDotNet.Validators; - -namespace Microsoft.AspNetCore.Server.Kestrel.Performance -{ - public class CoreConfig : ManualConfig - { - public CoreConfig() : this(Job.Core - .WithRemoveOutliers(false) - .With(new GcMode() { Server = true }) - .With(RunStrategy.Throughput) - .WithLaunchCount(3) - .WithWarmupCount(5) - .WithTargetCount(10)) - { - Add(JitOptimizationsValidator.FailOnError); - } - - public CoreConfig(Job job) - { - Add(DefaultConfig.Instance); - - Add(MemoryDiagnoser.Default); - Add(StatisticColumn.OperationsPerSecond); - - Add(job); - } - } -}