Regression in New BlazorServer Template Build Time
See original GitHub issueDescribe the bug
There is a ~850ms regression in the BlazorServer template build time in the perf lab.
To Reproduce
- Download the latest SDK.
- dotnet new blazorserver
- dotnet build
On my local machine, this shows up as a warm regression (not the first run) of 197ms. Here are the longest 6 targets of each run. I have narrowed it down to at the CoreCompile target - possibly some affect from ResolveAssemblyReferences.
Baseline:
Event Name | Time MSec | Process Name | DURATION__MSEC | targetName
Microsoft-Build/Target/Stop | 7,469.455 | dotnet (21624) | 290.792 | CoreCompile
Microsoft-Build/Target/Stop | 7,021.423 | dotnet (21624) | 196.984 | ResolveAssemblyReferences
Microsoft-Build/Target/Stop | 7,798.614 | dotnet (21624) | 193.787 | _GenerateScopedCssFiles
Microsoft-Build/Target/Stop | 6,535.790 | dotnet (21624) | 190.571 | Restore
Microsoft-Build/Target/Stop | 7,584.268 | dotnet (21624) | 114.501 | _CreateAppHost
Microsoft-Build/Target/Stop | 7,915.979 | dotnet (21624) | 101.780 | RazorCoreCompile
Regression:
Event Name | Time MSec | Process Name | DURATION__MSEC | targetName
Microsoft-Build/Target/Stop | 5,206.817 | dotnet (22608) | 506.903 | CoreCompile
Microsoft-Build/Target/Stop | 5,585.427 | dotnet (22608) | 241.141 | _GenerateScopedCssFiles
Microsoft-Build/Target/Stop | 4,544.413 | dotnet (22608) | 202.694 | ResolveAssemblyReferences
Microsoft-Build/Target/Stop | 4,075.320 | dotnet (22608) | 191.395 | Restore
Microsoft-Build/Target/Stop | 5,326.960 | dotnet (22608) | 119.798 | _CreateAppHost
Microsoft-Build/Target/Stop | 5,701.839 | dotnet (22608) | 97.088 | RazorCoreCompile
I can share traces if it’s helpful.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
.NET 8 Web-Dev: New Visual Studio Templates ...
Specifically, Visual Studio 2022 includes new project templates for Angular, React and Vue that are built on a new JavaScript project type ...
Read more >vs 2022 17.0.3: blazor server project: is running low ...
Using our production blazor server project after making code changes the background task start running, my CPU fan starts spinning, and the error...
Read more >aspnetcore 8 preview 4 blazor wasm size regression #86601
I have searched the existing issues Describe the bug The minimum size of blazor wasm app in .net 7 is 1.1 MB but...
Read more >Blazor app requires server restart every change I make
I'm developing on my localhost a new Blazor server-hosted app. I launch the template that it starts you out on... looks very nice....
Read more >ASP.NET Core Blazor performance best practices
In this article. Optimize rendering speed; Optimize JavaScript interop speed; Ahead-of-time (AOT) compilation; Minimize app download size.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

https://github.com/dotnet/sdk/pull/16110 should resolve this. Waiting for this to flow to the installer to double confirm…
Tracked down the issue here.
So, in response to some feedback from the compiler team, we changed some of the caching logic that we use in the Razor source generator from leveraging a file-based cache to an in-memory cache. As part of this work, we leverage the module version ID as a unique identifier for values in the cache. The perf hit that we are seeing here is primarily a result of computing this identifier for assembly references in the current compilation. We incur this cost regardless of whether or not there is a cache hit/miss because the identifier is needed to resolve items in the cache.
With that in mind, I’m closing this issue as no-action for now for a couple of reasons: