Skip to content

Commit 639cdb1

Browse files
authored
[StaticWebAssets] Add benchmarking infrastructure (#49512)
* Adds a benchmarks project so that we can add microbenchmarks for different StaticWebAssets tasks/features.
1 parent ef8bffe commit 639cdb1

File tree

9 files changed

+70
-1
lines changed

9 files changed

+70
-1
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<!-- Using multiple feeds isn't supported by Maestro: https://github.com/dotnet/arcade/issues/14155. -->
55
<NoWarn>$(NoWarn);NU1507</NoWarn>
66
</PropertyGroup>
7-
87
<ItemGroup>
98
<PackageVersion Include="Basic.CompilerLog.Util" Version="0.9.9" />
109
<PackageVersion Include="AwesomeAssertions" Version="$(AwesomeAssertionsVersion)" />
10+
<PackageVersion Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" />
1111
<PackageVersion Include="AwesomeAssertions.Json" Version="$(AwesomeAssertionsJsonVersion)" />
1212
<PackageVersion Include="MicroBuild.Plugins.SwixBuild.Dotnet" Version="1.1.87-gba258badda" />
1313
<PackageVersion Include="Microsoft.ApplicationInsights" Version="$(MicrosoftApplicationInsightsPackageVersion)" />

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@
326326
<MSTestVersion>3.10.0-preview.25319.7</MSTestVersion>
327327
<XunitCombinatorialVersion>1.3.2</XunitCombinatorialVersion>
328328
<MicrosoftDotNetInstallerWindowsSecurityTestDataPackageVersion>8.0.0-beta.23607.1</MicrosoftDotNetInstallerWindowsSecurityTestDataPackageVersion>
329+
<BenchmarkDotNetPackageVersion>0.14.0</BenchmarkDotNetPackageVersion>
329330
</PropertyGroup>
330331
<PropertyGroup Label="Workload manifest package versions">
331332
<AspireFeatureBand>8.0.100</AspireFeatureBand>

sdk.slnx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@
138138
<Folder Name="/src/StaticWebAssetsSdk/">
139139
<File Path="src/StaticWebAssetsSdk/.editorconfig" />
140140
</Folder>
141+
<Folder Name="/src/StaticWebAssetsSdk/benchmarks/">
142+
<Project Path="src/StaticWebAssetsSdk/benchmarks/Microsoft.NET.Sdk.StaticWebAssets.Benchmarks.csproj" />
143+
</Folder>
141144
<Folder Name="/src/StaticWebAssetsSdk/Sdk/">
142145
<File Path="src/StaticWebAssetsSdk/Sdk/Sdk.props" />
143146
<File Path="src/StaticWebAssetsSdk/Sdk/Sdk.StaticWebAssets.StaticAssets.ProjectSystem.props" />

src/RazorSdk/Razor.slnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"src\\RazorSdk\\Tool\\Microsoft.NET.Sdk.Razor.Tool.csproj",
1111
"src\\Resolvers\\Microsoft.DotNet.NativeWrapper\\Microsoft.DotNet.NativeWrapper.csproj",
1212
"src\\StaticWebAssetsSdk\\Tasks\\Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj",
13+
"src\\StaticWebAssetsSdk\\benchmarks\\Microsoft.NET.Sdk.StaticWebAssets.Benchmarks.csproj",
1314
"src\\WasmSdk\\Tasks\\Microsoft.NET.Sdk.WebAssembly.Tasks.csproj",
1415
"test\\Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests\\Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj",
1516
"test\\Microsoft.NET.Sdk.BlazorWebAssembly.Tests\\Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BenchmarkDotNet.Artifacts/**
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Project></Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using BenchmarkDotNet.Attributes;
5+
6+
namespace Microsoft.NET.Sdk.StaticWebAssets.Benchmarks;
7+
8+
[MemoryDiagnoser]
9+
public class EmptyBenchmark
10+
{
11+
[Benchmark]
12+
public void Baseline() { }
13+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFrameworks>net10.0;net472</TargetFrameworks>
5+
<Description>Benchmarks for Microsoft.NET.Sdk.StaticWebAssets</Description>
6+
<RootNamespace>Microsoft.NET.Sdk.StaticWebAssets.Benchmarks</RootNamespace>
7+
<IsPackable>false</IsPackable>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="BenchmarkDotNet" />
13+
<PackageReference Include="Microsoft.Build.Framework" />
14+
<PackageReference Include="Microsoft.Build.Utilities.Core" />
15+
</ItemGroup>
16+
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
17+
<PackageReference Include="System.Text.Json" />
18+
</ItemGroup>
19+
<ItemGroup>
20+
<ProjectReference Include="..\Tasks\Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<None Include="Directory.Build.template">
25+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
26+
<TargetPath>Directory.Build.props</TargetPath>
27+
</None>
28+
<None Include="Directory.Build.template">
29+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
30+
<TargetPath>Directory.Build.targets</TargetPath>
31+
</None>
32+
</ItemGroup>
33+
34+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using BenchmarkDotNet.Running;
5+
6+
namespace Microsoft.NET.Sdk.StaticWebAssets.Benchmarks;
7+
8+
public class Program
9+
{
10+
public static void Main(string[] args)
11+
{
12+
// Run all benchmarks
13+
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
14+
}
15+
}

0 commit comments

Comments
 (0)