Add benchmarks project
This commit is contained in:
19
tests/Roslyn.Benchmarks/MSBuildWorkspaceBenchmarks.cs
Normal file
19
tests/Roslyn.Benchmarks/MSBuildWorkspaceBenchmarks.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Diagnostics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.MSBuild;
|
||||
|
||||
namespace Roslyn.Benchmarks;
|
||||
|
||||
public class MSBuildWorkspaceBenchmarks
|
||||
{
|
||||
private const string _solutionFilePath = "C:/Users/Matthew/Documents/Git/StatusApp/StatusApp.sln";
|
||||
|
||||
[Benchmark]
|
||||
public async Task<Solution> ParseSolutionFileFromPath()
|
||||
{
|
||||
var workspace = MSBuildWorkspace.Create();
|
||||
var solution = await workspace.OpenSolutionAsync(_solutionFilePath);
|
||||
return solution;
|
||||
}
|
||||
}
|
||||
4
tests/Roslyn.Benchmarks/Program.cs
Normal file
4
tests/Roslyn.Benchmarks/Program.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
using BenchmarkDotNet.Running;
|
||||
using Roslyn.Benchmarks;
|
||||
|
||||
BenchmarkRunner.Run<MSBuildWorkspaceBenchmarks>();
|
||||
16
tests/Roslyn.Benchmarks/Roslyn.Benchmarks.csproj
Normal file
16
tests/Roslyn.Benchmarks/Roslyn.Benchmarks.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.12.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user