Skip to content

[StaticWebAssets] Add benchmarking infrastructure #49512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<!-- Using multiple feeds isn't supported by Maestro: https://github.com/dotnet/arcade/issues/14155. -->
<NoWarn>$(NoWarn);NU1507</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Basic.CompilerLog.Util" Version="0.9.9" />
<PackageVersion Include="AwesomeAssertions" Version="$(AwesomeAssertionsVersion)" />
<PackageVersion Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" />
<PackageVersion Include="AwesomeAssertions.Json" Version="$(AwesomeAssertionsJsonVersion)" />
<PackageVersion Include="MicroBuild.Plugins.SwixBuild.Dotnet" Version="1.1.87-gba258badda" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="$(MicrosoftApplicationInsightsPackageVersion)" />
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
<MSTestVersion>3.10.0-preview.25318.4</MSTestVersion>
<XunitCombinatorialVersion>1.3.2</XunitCombinatorialVersion>
<MicrosoftDotNetInstallerWindowsSecurityTestDataPackageVersion>8.0.0-beta.23607.1</MicrosoftDotNetInstallerWindowsSecurityTestDataPackageVersion>
<BenchmarkDotNetPackageVersion>0.14.0</BenchmarkDotNetPackageVersion>
</PropertyGroup>
<PropertyGroup Label="Workload manifest package versions">
<AspireFeatureBand>8.0.100</AspireFeatureBand>
Expand Down
3 changes: 3 additions & 0 deletions sdk.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@
<Folder Name="/src/StaticWebAssetsSdk/">
<File Path="src/StaticWebAssetsSdk/.editorconfig" />
</Folder>
<Folder Name="/src/StaticWebAssetsSdk/benchmarks/">
<Project Path="src/StaticWebAssetsSdk/benchmarks/Microsoft.NET.Sdk.StaticWebAssets.Benchmarks.csproj" />
</Folder>
<Folder Name="/src/StaticWebAssetsSdk/Sdk/">
<File Path="src/StaticWebAssetsSdk/Sdk/Sdk.props" />
<File Path="src/StaticWebAssetsSdk/Sdk/Sdk.StaticWebAssets.StaticAssets.ProjectSystem.props" />
Expand Down
1 change: 1 addition & 0 deletions src/RazorSdk/Razor.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"src\\RazorSdk\\Tool\\Microsoft.NET.Sdk.Razor.Tool.csproj",
"src\\Resolvers\\Microsoft.DotNet.NativeWrapper\\Microsoft.DotNet.NativeWrapper.csproj",
"src\\StaticWebAssetsSdk\\Tasks\\Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj",
"src\\StaticWebAssetsSdk\\benchmarks\\Microsoft.NET.Sdk.StaticWebAssets.Benchmarks.csproj",
"src\\WasmSdk\\Tasks\\Microsoft.NET.Sdk.WebAssembly.Tasks.csproj",
"test\\Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests\\Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj",
"test\\Microsoft.NET.Sdk.BlazorWebAssembly.Tests\\Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions src/StaticWebAssetsSdk/benchmarks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BenchmarkDotNet.Artifacts/**
1 change: 1 addition & 0 deletions src/StaticWebAssetsSdk/benchmarks/Directory.Build.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Project></Project>
13 changes: 13 additions & 0 deletions src/StaticWebAssetsSdk/benchmarks/EmptyBenchmark.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using BenchmarkDotNet.Attributes;

namespace Microsoft.NET.Sdk.StaticWebAssets.Benchmarks;

[MemoryDiagnoser]
public class EmptyBenchmark
{
[Benchmark]
public void Baseline() { }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Description>Benchmarks for Microsoft.NET.Sdk.StaticWebAssets</Description>
<RootNamespace>Microsoft.NET.Sdk.StaticWebAssets.Benchmarks</RootNamespace>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tasks\Microsoft.NET.Sdk.StaticWebAssets.Tasks.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="Directory.Build.template">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<TargetPath>Directory.Build.props</TargetPath>
</None>
<None Include="Directory.Build.template">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<TargetPath>Directory.Build.targets</TargetPath>
</None>
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

</Project>
15 changes: 15 additions & 0 deletions src/StaticWebAssetsSdk/benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using BenchmarkDotNet.Running;

namespace Microsoft.NET.Sdk.StaticWebAssets.Benchmarks;

public class Program
{
public static void Main(string[] args)
{
// Run all benchmarks
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
}
}