From 78cf97cf3af1a6f64ff146bd8904e5dfde30f110 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Mon, 20 Aug 2018 20:09:33 -0700 Subject: [PATCH 1/2] Fix broken benchmarks The tests for matching still compile but do the wrong thing, because they aren't setting up the HTTP method metadata correctly. Adding back an overload of CreateEndpoint that's like what was there before. --- .../EndpointRoutingBenchmarkBase.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/EndpointRoutingBenchmarkBase.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/EndpointRoutingBenchmarkBase.cs index ece73b75a4..9e3f050d8d 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/EndpointRoutingBenchmarkBase.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/EndpointRoutingBenchmarkBase.cs @@ -97,6 +97,14 @@ namespace Microsoft.AspNetCore.Routing } } + protected RouteEndpoint CreateEndpoint(string template, string httpMethod) + { + return CreateEndpoint(template, metadata: new object[] + { + new HttpMethodMetadata(new string[]{ httpMethod, }), + }); + } + protected RouteEndpoint CreateEndpoint( string template, object defaults = null, From e90e670ac8f7f41a5de89ac7f34abd805abc9128 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Mon, 20 Aug 2018 21:10:19 -0700 Subject: [PATCH 2/2] Enable benchmark validation Move Swaggather out of benchmarks folder Add MSBuild junk Fix broken tests --- Routing.sln | 30 ++++++++++--------- .../JumpTableMultipleEntryBenchmark.cs | 2 +- .../MatcherFindCandidateSetAzureBenchmark.cs | 4 +-- .../MatcherFindCandidateSetGithubBenchmark.cs | 4 +-- ...soft.AspNetCore.Routing.Performance.csproj | 2 +- build/repo.props | 4 +++ {benchmarks => tools}/Swaggatherer/Program.cs | 0 {benchmarks => tools}/Swaggatherer/README.md | 0 .../Swaggatherer/RouteEntry.cs | 0 .../Swaggatherer/Swaggatherer.csproj | 0 .../Swaggatherer/SwaggathererApplication.cs | 0 .../Swaggatherer/Template.cs | 0 12 files changed, 26 insertions(+), 20 deletions(-) rename {benchmarks => tools}/Swaggatherer/Program.cs (100%) rename {benchmarks => tools}/Swaggatherer/README.md (100%) rename {benchmarks => tools}/Swaggatherer/RouteEntry.cs (100%) rename {benchmarks => tools}/Swaggatherer/Swaggatherer.csproj (100%) rename {benchmarks => tools}/Swaggatherer/SwaggathererApplication.cs (100%) rename {benchmarks => tools}/Swaggatherer/Template.cs (100%) diff --git a/Routing.sln b/Routing.sln index 6b34e4f0b0..632e7fe0c3 100644 --- a/Routing.sln +++ b/Routing.sln @@ -51,7 +51,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarkapps", "benchmarka EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "benchmarkapps\Benchmarks\Benchmarks.csproj", "{91F47A60-9A78-4968-B10D-157D9BFAC37F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Swaggatherer", "benchmarks\Swaggatherer\Swaggatherer.csproj", "{990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{6824486A-3EFF-45D1-BEE8-8B137639C890}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Swaggatherer", "tools\Swaggatherer\Swaggatherer.csproj", "{B8516771-E850-4724-BEC3-63FC00C2AE57}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -165,18 +167,18 @@ Global {91F47A60-9A78-4968-B10D-157D9BFAC37F}.Release|Mixed Platforms.Build.0 = Release|Any CPU {91F47A60-9A78-4968-B10D-157D9BFAC37F}.Release|x86.ActiveCfg = Release|Any CPU {91F47A60-9A78-4968-B10D-157D9BFAC37F}.Release|x86.Build.0 = Release|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Debug|x86.ActiveCfg = Debug|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Debug|x86.Build.0 = Debug|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Release|Any CPU.Build.0 = Release|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Release|x86.ActiveCfg = Release|Any CPU - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D}.Release|x86.Build.0 = Release|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Debug|x86.ActiveCfg = Debug|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Debug|x86.Build.0 = Debug|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Release|Any CPU.Build.0 = Release|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Release|x86.ActiveCfg = Release|Any CPU + {B8516771-E850-4724-BEC3-63FC00C2AE57}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -191,7 +193,7 @@ Global {5C73140B-41F3-466F-A07B-3614E4D80DF9} = {95359B4B-4C85-4B44-A75B-0621905C4CF6} {F3D86714-4E64-41A6-9B36-A47B3683CF5D} = {D5F39F59-5725-4127-82E7-67028D006185} {91F47A60-9A78-4968-B10D-157D9BFAC37F} = {7F5914E2-C63F-4759-898E-462804357C90} - {990ECDEE-49DE-45E3-B0D9-DDEB9CFF6A9D} = {D5F39F59-5725-4127-82E7-67028D006185} + {B8516771-E850-4724-BEC3-63FC00C2AE57} = {6824486A-3EFF-45D1-BEE8-8B137639C890} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {36C8D815-B7F1-479D-894B-E606FB8DECDA} diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableMultipleEntryBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableMultipleEntryBenchmark.cs index d34792ae5f..410dbe85ab 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableMultipleEntryBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableMultipleEntryBenchmark.cs @@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.Routing.Matching _linearSearch = new LinearSearchJumpTable(0, -1, entries.ToArray()); _dictionary = new DictionaryJumpTable(0, -1, entries.ToArray()); - Debug.Assert(AsciiKeyedJumpTable.TryCreate(0, -1, entries, out _ascii)); + AsciiKeyedJumpTable.TryCreate(0, -1, entries, out _ascii); _dictionaryLookup = new DictionaryLookupJumpTable(0, -1, entries.ToArray()); _customHashTable = new CustomHashTableJumpTable(0, -1, entries.ToArray()); } diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.cs index 2f54d1bdbb..ab1e371911 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.cs @@ -10,8 +10,8 @@ namespace Microsoft.AspNetCore.Routing.Matching public partial class MatcherFindCandidateSetAzureBenchmark : EndpointRoutingBenchmarkBase { // SegmentCount should be max-segments + 1, but we don't have a good way to compute - // it here, so using 16 as a safe guess. - private const int SegmentCount = 16; + // it here, so using 32 as a safe guess. + private const int SegmentCount = 32; private const int SampleCount = 100; diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.cs index bc6751f0ca..acbfdd0cf6 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.cs @@ -12,8 +12,8 @@ namespace Microsoft.AspNetCore.Routing.Matching public partial class MatcherFindCandidateSetGithubBenchmark : EndpointRoutingBenchmarkBase { // SegmentCount should be max-segments + 1, but we don't have a good way to compute - // it here, so using 16 as a safe guess. - private const int SegmentCount = 16; + // it here, so using 32 as a safe guess. + private const int SegmentCount = 32; private BarebonesMatcher _baseline; private DfaMatcher _dfa; diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Microsoft.AspNetCore.Routing.Performance.csproj b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Microsoft.AspNetCore.Routing.Performance.csproj index d1e25aa6f0..99413eb58b 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Microsoft.AspNetCore.Routing.Performance.csproj +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Microsoft.AspNetCore.Routing.Performance.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp2.2 Exe true true diff --git a/build/repo.props b/build/repo.props index f1fe24dd27..9747864f3e 100644 --- a/build/repo.props +++ b/build/repo.props @@ -13,4 +13,8 @@ + + + true + diff --git a/benchmarks/Swaggatherer/Program.cs b/tools/Swaggatherer/Program.cs similarity index 100% rename from benchmarks/Swaggatherer/Program.cs rename to tools/Swaggatherer/Program.cs diff --git a/benchmarks/Swaggatherer/README.md b/tools/Swaggatherer/README.md similarity index 100% rename from benchmarks/Swaggatherer/README.md rename to tools/Swaggatherer/README.md diff --git a/benchmarks/Swaggatherer/RouteEntry.cs b/tools/Swaggatherer/RouteEntry.cs similarity index 100% rename from benchmarks/Swaggatherer/RouteEntry.cs rename to tools/Swaggatherer/RouteEntry.cs diff --git a/benchmarks/Swaggatherer/Swaggatherer.csproj b/tools/Swaggatherer/Swaggatherer.csproj similarity index 100% rename from benchmarks/Swaggatherer/Swaggatherer.csproj rename to tools/Swaggatherer/Swaggatherer.csproj diff --git a/benchmarks/Swaggatherer/SwaggathererApplication.cs b/tools/Swaggatherer/SwaggathererApplication.cs similarity index 100% rename from benchmarks/Swaggatherer/SwaggathererApplication.cs rename to tools/Swaggatherer/SwaggathererApplication.cs diff --git a/benchmarks/Swaggatherer/Template.cs b/tools/Swaggatherer/Template.cs similarity index 100% rename from benchmarks/Swaggatherer/Template.cs rename to tools/Swaggatherer/Template.cs