diff --git a/.gitignore b/.gitignore index cfa25ee7fc..9432c1a8b7 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,5 @@ project.lock.json .vs/ launchSettings.json global.json -.vscode/* \ No newline at end of file +.vscode/* +BenchmarkDotNet.Artifacts/ \ No newline at end of file diff --git a/Razor.sln b/Razor.sln index 1d601dcf19..aa9672ac9a 100644 --- a/Razor.sln +++ b/Razor.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26327.1 +VisualStudioVersion = 15.0.26228.9 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C0D6505-79B3-49D0-B4C3-176F0F1836ED}" EndProject @@ -49,6 +49,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Ra EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.Common", "test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj", "{078AEF36-F319-4CE2-BAA2-5B58A6536B46}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Performance", "test\Microsoft.AspNetCore.Razor.Performance\Microsoft.AspNetCore.Razor.Performance.csproj", "{82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -191,6 +193,14 @@ Global {078AEF36-F319-4CE2-BAA2-5B58A6536B46}.Release|Any CPU.Build.0 = Release|Any CPU {078AEF36-F319-4CE2-BAA2-5B58A6536B46}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {078AEF36-F319-4CE2-BAA2-5B58A6536B46}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}.Release|Any CPU.Build.0 = Release|Any CPU + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -213,5 +223,6 @@ Global {995F2FEB-65FA-4399-B1C0-16E0B3FBDB15} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {7CFD5646-A757-4498-9E01-9C8528ED60AE} = {92463391-81BE-462B-AC3C-78C6C760741F} {078AEF36-F319-4CE2-BAA2-5B58A6536B46} = {92463391-81BE-462B-AC3C-78C6C760741F} + {82C23CF8-95FF-40F7-BF50-3AD9EE21ED58} = {92463391-81BE-462B-AC3C-78C6C760741F} EndGlobalSection EndGlobal diff --git a/build/dependencies.props b/build/dependencies.props index 693cddb8a8..19a7748477 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,6 +1,7 @@ 2.0.0-* + 0.10.3 4.3.0 2.0.0-* 10.0.1 diff --git a/build/repo.props b/build/repo.props index d20e299892..f8da117175 100644 --- a/build/repo.props +++ b/build/repo.props @@ -2,5 +2,6 @@ + diff --git a/test/Microsoft.AspNetCore.Razor.Performance/Configs/CoreConfig.cs b/test/Microsoft.AspNetCore.Razor.Performance/Configs/CoreConfig.cs new file mode 100644 index 0000000000..9e93e361c0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Performance/Configs/CoreConfig.cs @@ -0,0 +1,31 @@ +// 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.Razor.Performance +{ + public class CoreConfig : ManualConfig + { + public CoreConfig() + { + Add(JitOptimizationsValidator.FailOnError); + Add(MemoryDiagnoser.Default); + Add(StatisticColumn.OperationsPerSecond); + + Add(Job.Default + .With(BenchmarkDotNet.Environments.Runtime.Core) + .WithRemoveOutliers(false) + .With(new GcMode() { Server = true }) + .With(RunStrategy.Throughput) + .WithLaunchCount(3) + .WithWarmupCount(5) + .WithTargetCount(10)); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj b/test/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj new file mode 100644 index 0000000000..268a7edd83 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj @@ -0,0 +1,26 @@ + + + + + + netcoreapp2.0 + Exe + true + true + false + + 2.0.0-* + + + + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Performance/Program.cs b/test/Microsoft.AspNetCore.Razor.Performance/Program.cs new file mode 100644 index 0000000000..9191a1098c --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Performance/Program.cs @@ -0,0 +1,17 @@ +// 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 System; +using System.Reflection; +using BenchmarkDotNet.Running; + +namespace Microsoft.AspNetCore.Razor.Performance +{ + public class Program + { + public static void Main(string[] args) + { + BenchmarkSwitcher.FromAssembly(typeof(Program).GetTypeInfo().Assembly).Run(args); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Performance/readme.md b/test/Microsoft.AspNetCore.Razor.Performance/readme.md new file mode 100644 index 0000000000..38ce0ff71a --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Performance/readme.md @@ -0,0 +1,11 @@ +Compile the solution in Release mode (so binaries are available in release) + +To run a specific benchmark add it as parameter. +``` +dotnet run -c Release +``` + +If you run without any parameters, you'll be offered the list of all benchmarks and get to choose. +``` +dotnet run -c Release +``` \ No newline at end of file