From afa8e91f0a0bef3a708fb9ee5753a1bb1541a06a Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Tue, 6 Feb 2024 14:57:00 -0800 Subject: [PATCH 1/6] Update Blazor build perf scenarios --- src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs | 2 +- src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs b/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs index 2d05a8733..9bb2c9277 100644 --- a/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs +++ b/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs @@ -19,7 +19,7 @@ public BlazorServerScenario(DotNet dotnet) public async Task RunAsync() { - await _dotnet.ExecuteAsync($"new blazor --use-server"); + await _dotnet.ExecuteAsync($"new blazor -int Server"); await Build(); diff --git a/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs b/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs index 198736962..2ae993a69 100644 --- a/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs +++ b/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs @@ -24,11 +24,11 @@ public BlazorWasmHosted(DotNet dotNet) public async Task RunAsync() { - await _dotnet.ExecuteAsync($"new blazor --use-wasm"); + await _dotnet.ExecuteAsync($"new blazor -int WebAssembly"); await Build(); - // Change + // Change await ChangeShared(); // Changes to .razor file markup From a630ecbaeff117d5416fee05e377ebf76d83a18b Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Tue, 6 Feb 2024 15:16:45 -0800 Subject: [PATCH 2/6] Update 'BlazorWasmHosted.cs' --- .../BuildPerformance/BlazorWasmHosted.cs | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs b/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs index 2ae993a69..b6e8cb206 100644 --- a/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs +++ b/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs @@ -9,6 +9,8 @@ namespace Build { class BlazorWasmHosted { + private const string ProjectName = "BlazorApp"; + private readonly DotNet _dotnet; private readonly string _workingDirectory; private readonly string _serverDirectory; @@ -18,19 +20,16 @@ public BlazorWasmHosted(DotNet dotNet) { _dotnet = dotNet; _workingDirectory = dotNet.WorkingDirectory; - _serverDirectory = Path.Combine(_workingDirectory, "Server"); - _clientDirectory = Path.Combine(_workingDirectory, "Client"); + _serverDirectory = Path.Combine(_workingDirectory, ProjectName); + _clientDirectory = Path.Combine(_workingDirectory, $"{ProjectName}.Client"); } public async Task RunAsync() { - await _dotnet.ExecuteAsync($"new blazor -int WebAssembly"); + await _dotnet.ExecuteAsync($"new blazor -n {ProjectName} -int WebAssembly"); await Build(); - // Change - await ChangeShared(); - // Changes to .razor file markup await ChangeClient(); @@ -67,23 +66,9 @@ async Task ChangeServer() "Change a file in Server"); } - async Task ChangeShared() - { - // Changes to .cs file - var csFile = Path.Combine(_workingDirectory, "Shared", "WeatherForecast.cs"); - File.AppendAllText(csFile, Environment.NewLine + "// Hello world"); - - var buildDuration = await _dotnet.ExecuteAsync("build --no-restore", _serverDirectory); - - MeasureAndRegister( - "blazorwasm-hosted/shared-file", - buildDuration.TotalMilliseconds, - "Change a file in shared"); - } - async Task ChangeClient() { - var indexRazorFile = Path.Combine(_clientDirectory, "Pages", "Index.razor"); + var indexRazorFile = Path.Combine(_clientDirectory, "Pages", "Counter.razor"); File.AppendAllText(indexRazorFile, Environment.NewLine + "

New content

"); var buildDuration = await _dotnet.ExecuteAsync("build --no-restore", _serverDirectory); From ebda92a2cc8e51eb83a7c0af088599cf3af9d27e Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Tue, 6 Feb 2024 15:19:22 -0800 Subject: [PATCH 3/6] Update "BlazorWasmHosted.cs" --- src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs b/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs index b6e8cb206..beb773747 100644 --- a/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs +++ b/src/BenchmarksApps/BuildPerformance/BlazorWasmHosted.cs @@ -26,7 +26,7 @@ public BlazorWasmHosted(DotNet dotNet) public async Task RunAsync() { - await _dotnet.ExecuteAsync($"new blazor -n {ProjectName} -int WebAssembly"); + await _dotnet.ExecuteAsync($"new blazor -n {ProjectName} -o . -int WebAssembly"); await Build(); From 4239f5382d7c52b931b9af8f184af348f47b6139 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Tue, 6 Feb 2024 15:23:01 -0800 Subject: [PATCH 4/6] Update "BlazorServerScenario.cs" --- src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs b/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs index 9bb2c9277..81621cc95 100644 --- a/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs +++ b/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs @@ -68,7 +68,7 @@ async Task ChangeCSFile() async Task ChangeToRazorMarkup() { - var indexRazorFile = Path.Combine(_workingDirectory, "Components", "Pages", "Index.razor"); + var indexRazorFile = Path.Combine(_workingDirectory, "Components", "Pages", "Home.razor"); File.AppendAllText(indexRazorFile, Environment.NewLine + "

New content

"); var buildDuration = await _dotnet.ExecuteAsync("build --no-restore"); From 05a5fff750f559ed5fbe3214e013d4b569f0c099 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Tue, 6 Feb 2024 15:25:29 -0800 Subject: [PATCH 5/6] Update "BlazorServerScenario.cs" --- .../BuildPerformance/BlazorServerScenario.cs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs b/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs index 81621cc95..82d181a94 100644 --- a/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs +++ b/src/BenchmarksApps/BuildPerformance/BlazorServerScenario.cs @@ -35,9 +35,6 @@ public async Task RunAsync() // No-Op build await NoOpBuild(); - // Changes to a .cshtml file - await ModifyCshtmlFile(); - // Rebuild await Rebuild(); } @@ -117,20 +114,5 @@ async Task AddParameterToComponent() buildDuration.TotalMilliseconds, "Add a parameter to .razor"); } - - async Task ModifyCshtmlFile() - { - var file = Path.Combine(_workingDirectory, "App.razor"); - var originalContent = File.ReadAllText(file); - - File.WriteAllText(file, originalContent.Replace("", "

Some text

")); - - var buildDuration = await _dotnet.ExecuteAsync("build --no-restore"); - - MeasureAndRegister( - "blazorserver/razor-change-cshtml", - buildDuration.TotalMilliseconds, - "Change .cshtml file markup"); - } } } From 5d879ace6d7002617d8f0bdc32979961df8c120f Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Tue, 6 Feb 2024 15:27:11 -0800 Subject: [PATCH 6/6] Update "build-perf-scenarios.yml" --- build/build-perf-scenarios.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/build/build-perf-scenarios.yml b/build/build-perf-scenarios.yml index 9843fd4a4..53f196c61 100644 --- a/build/build-perf-scenarios.yml +++ b/build/build-perf-scenarios.yml @@ -15,11 +15,10 @@ parameters: - displayName: "Build - BlazorWasm" arguments: --scenario blazorwasm $(buildJobs) --property scenario=BlazorWasm - # Skip https://github.com/dotnet/aspnetcore/issues/49760 - # - displayName: "Build - BlazorWasm (Hosted)" - # arguments: --scenario blazorwasm-hosted $(buildJobs) --property scenario=BlazorWasmHosted - # - displayName: "Build - BlazorServer" - # arguments: --scenario blazorserver $(buildJobs) --property scenario=BlazorServer + - displayName: "Build - BlazorWasm (Hosted)" + arguments: --scenario blazorwasm-hosted $(buildJobs) --property scenario=BlazorWasmHosted + - displayName: "Build - BlazorServer" + arguments: --scenario blazorserver $(buildJobs) --property scenario=BlazorServer - displayName: "Build - MVC" arguments: --scenario mvc $(buildJobs) --property scenario=MVC - displayName: "Build - API"