rearrange
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using Microsoft.CodeAnalysis.MSBuild;
|
||||
|
||||
namespace SharpIDE.Application.Features.SolutionDiscovery;
|
||||
|
||||
public class Progress : IProgress<ProjectLoadProgress>
|
||||
{
|
||||
public void Report(ProjectLoadProgress value)
|
||||
{
|
||||
Console.WriteLine($"{value.Operation} completed for {value.FilePath} ({value.TargetFramework}) in {value.ElapsedTime.TotalMilliseconds}ms");
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,9 @@ public static class RoslynTest
|
||||
{
|
||||
public static async Task Analyse(string solutionFilePath)
|
||||
{
|
||||
|
||||
|
||||
var workspace = MSBuildWorkspace.Create();
|
||||
var timer = Stopwatch.StartNew();
|
||||
var solution = await workspace.OpenSolutionAsync(solutionFilePath);
|
||||
var solution = await workspace.OpenSolutionAsync(solutionFilePath, new Progress());
|
||||
timer.Stop();
|
||||
Console.WriteLine($"Solution loaded in {timer.ElapsedMilliseconds}ms");
|
||||
Console.WriteLine();
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(100);
|
||||
await RoslynTest.Analyse("C:/Users/Matthew/Documents/Git/StatusApp/StatusApp.sln");
|
||||
await RoslynTest.Analyse("C:/Users/Matthew/Documents/Git/amazon/ClientPortal.sln");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Program
|
||||
app.MainWindow
|
||||
.SetSize(1400, 800)
|
||||
.SetDevToolsEnabled(true)
|
||||
.SetMaximized(true)
|
||||
//.SetMaximized(true)
|
||||
.SetLogVerbosity(0)
|
||||
//.SetIconFile("favicon.ico")
|
||||
.SetTitle("SharpIDE.Photino");
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Microsoft.CodeAnalysis.MSBuild;
|
||||
|
||||
namespace Roslyn.Benchmarks;
|
||||
|
||||
public class MSBuildWorkspaceBenchmarks
|
||||
public class CreateWorkspaceBenchmarks
|
||||
{
|
||||
private const string _solutionFilePath = "C:/Users/Matthew/Documents/Git/StatusApp/StatusApp.sln";
|
||||
|
||||
// | Method | Mean | Error | StdDev |
|
||||
// |-------------------------- |---------:|---------:|---------:|
|
||||
// | CreateWorkspaceNoParams | 10.88 us | 0.045 us | 0.042 us |
|
||||
@@ -32,11 +28,4 @@ public class MSBuildWorkspaceBenchmarks
|
||||
return workspace;
|
||||
}
|
||||
|
||||
// [Benchmark]
|
||||
// public async Task<Solution> ParseSolutionFileFromPath()
|
||||
// {
|
||||
// var workspace = MSBuildWorkspace.Create();
|
||||
// var solution = await workspace.OpenSolutionAsync(_solutionFilePath);
|
||||
// return solution;
|
||||
// }
|
||||
}
|
||||
21
tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs
Normal file
21
tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.MSBuild;
|
||||
|
||||
namespace Roslyn.Benchmarks;
|
||||
|
||||
public class ParseSolutionBenchmarks
|
||||
{
|
||||
private const string _solutionFilePath = "C:/Users/Matthew/Documents/Git/StatusApp/StatusApp.sln";
|
||||
|
||||
|
||||
//[IterationSetup]
|
||||
|
||||
[Benchmark]
|
||||
public async Task<Solution> ParseSolutionFileFromPath()
|
||||
{
|
||||
var workspace = MSBuildWorkspace.Create();
|
||||
var solution = await workspace.OpenSolutionAsync(_solutionFilePath);
|
||||
return solution;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using BenchmarkDotNet.Running;
|
||||
using Roslyn.Benchmarks;
|
||||
|
||||
BenchmarkRunner.Run<MSBuildWorkspaceBenchmarks>();
|
||||
//BenchmarkRunner.Run<CreateWorkspaceBenchmarks>();
|
||||
BenchmarkRunner.Run<ParseSolutionBenchmarks>();
|
||||
|
||||
Reference in New Issue
Block a user