diff --git a/src/SharpIDE.Application/Features/SolutionDiscovery/Progress.cs b/src/SharpIDE.Application/Features/SolutionDiscovery/Progress.cs new file mode 100644 index 0000000..6634f6d --- /dev/null +++ b/src/SharpIDE.Application/Features/SolutionDiscovery/Progress.cs @@ -0,0 +1,11 @@ +using Microsoft.CodeAnalysis.MSBuild; + +namespace SharpIDE.Application.Features.SolutionDiscovery; + +public class Progress : IProgress +{ + public void Report(ProjectLoadProgress value) + { + Console.WriteLine($"{value.Operation} completed for {value.FilePath} ({value.TargetFramework}) in {value.ElapsedTime.TotalMilliseconds}ms"); + } +} diff --git a/src/SharpIDE.Application/Features/SolutionDiscovery/RoslynTest.cs b/src/SharpIDE.Application/Features/SolutionDiscovery/RoslynTest.cs index dd332b0..d506b50 100644 --- a/src/SharpIDE.Application/Features/SolutionDiscovery/RoslynTest.cs +++ b/src/SharpIDE.Application/Features/SolutionDiscovery/RoslynTest.cs @@ -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(); diff --git a/src/SharpIDE.Photino/Pages/Home.razor b/src/SharpIDE.Photino/Pages/Home.razor index 38aadb3..12ab60a 100644 --- a/src/SharpIDE.Photino/Pages/Home.razor +++ b/src/SharpIDE.Photino/Pages/Home.razor @@ -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"); } } diff --git a/src/SharpIDE.Photino/Program.cs b/src/SharpIDE.Photino/Program.cs index 0f14fed..1f7ef40 100644 --- a/src/SharpIDE.Photino/Program.cs +++ b/src/SharpIDE.Photino/Program.cs @@ -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"); diff --git a/tests/Roslyn.Benchmarks/MSBuildWorkspaceBenchmarks.cs b/tests/Roslyn.Benchmarks/CreateWorkspaceBenchmarks.cs similarity index 61% rename from tests/Roslyn.Benchmarks/MSBuildWorkspaceBenchmarks.cs rename to tests/Roslyn.Benchmarks/CreateWorkspaceBenchmarks.cs index cd15f1d..1544400 100644 --- a/tests/Roslyn.Benchmarks/MSBuildWorkspaceBenchmarks.cs +++ b/tests/Roslyn.Benchmarks/CreateWorkspaceBenchmarks.cs @@ -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 ParseSolutionFileFromPath() - // { - // var workspace = MSBuildWorkspace.Create(); - // var solution = await workspace.OpenSolutionAsync(_solutionFilePath); - // return solution; - // } } diff --git a/tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs b/tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs new file mode 100644 index 0000000..f3de867 --- /dev/null +++ b/tests/Roslyn.Benchmarks/ParseSolutionBenchmarks.cs @@ -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 ParseSolutionFileFromPath() + { + var workspace = MSBuildWorkspace.Create(); + var solution = await workspace.OpenSolutionAsync(_solutionFilePath); + return solution; + } +} diff --git a/tests/Roslyn.Benchmarks/Program.cs b/tests/Roslyn.Benchmarks/Program.cs index 36f4a10..e6916b3 100644 --- a/tests/Roslyn.Benchmarks/Program.cs +++ b/tests/Roslyn.Benchmarks/Program.cs @@ -1,4 +1,5 @@ using BenchmarkDotNet.Running; using Roslyn.Benchmarks; -BenchmarkRunner.Run(); +//BenchmarkRunner.Run(); +BenchmarkRunner.Run();