Add BenchmarkDotNet boilerplate
This commit is contained in:
parent
0f7b0f5d8c
commit
acf3e759d1
|
|
@ -33,3 +33,4 @@ project.lock.json
|
||||||
launchSettings.json
|
launchSettings.json
|
||||||
global.json
|
global.json
|
||||||
.vscode/*
|
.vscode/*
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
13
Razor.sln
13
Razor.sln
|
|
@ -1,6 +1,6 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26327.1
|
VisualStudioVersion = 15.0.26228.9
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C0D6505-79B3-49D0-B4C3-176F0F1836ED}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C0D6505-79B3-49D0-B4C3-176F0F1836ED}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
@ -49,6 +49,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Ra
|
||||||
EndProject
|
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}"
|
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
|
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
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.ReleaseNoVSIX|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -213,5 +223,6 @@ Global
|
||||||
{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
|
{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
|
||||||
{7CFD5646-A757-4498-9E01-9C8528ED60AE} = {92463391-81BE-462B-AC3C-78C6C760741F}
|
{7CFD5646-A757-4498-9E01-9C8528ED60AE} = {92463391-81BE-462B-AC3C-78C6C760741F}
|
||||||
{078AEF36-F319-4CE2-BAA2-5B58A6536B46} = {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
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
|
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
|
||||||
|
<BenchmarkDotNetVersion>0.10.3</BenchmarkDotNetVersion>
|
||||||
<CoreFxVersion>4.3.0</CoreFxVersion>
|
<CoreFxVersion>4.3.0</CoreFxVersion>
|
||||||
<InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion>
|
<InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion>
|
||||||
<JsonNetVersion>10.0.1</JsonNetVersion>
|
<JsonNetVersion>10.0.1</JsonNetVersion>
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.VisualStudio.LanguageServices.Razor.Test\Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj" Condition="'$(OS)'!='Windows_NT'" />
|
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.VisualStudio.LanguageServices.Razor.Test\Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj" Condition="'$(OS)'!='Windows_NT'" />
|
||||||
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
|
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
|
||||||
|
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.AspNetCore.Razor.Performance\Microsoft.AspNetCore.Razor.Performance.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<!--
|
||||||
|
This is required right now for BenchmarkDotNet to restore the benchmarks. It is NOT ok to move this into
|
||||||
|
an imported .props file. See https://github.com/dotnet/BenchmarkDotNet/issues/406
|
||||||
|
-->
|
||||||
|
<RuntimeFrameworkVersion>2.0.0-*</RuntimeFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Razor.Extensions\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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 <benchmark_name>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you run without any parameters, you'll be offered the list of all benchmarks and get to choose.
|
||||||
|
```
|
||||||
|
dotnet run -c Release
|
||||||
|
```
|
||||||
Loading…
Reference in New Issue