question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression in New BlazorServer Template Build Time

See original GitHub issue

Describe the bug

There is a ~850ms regression in the BlazorServer template build time in the perf lab.

To Reproduce

  1. Download the latest SDK.
  2. dotnet new blazorserver
  3. 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.

cc: @DamianEdwards, @stephentoub

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
captainsafiacommented, Feb 27, 2021

https://github.com/dotnet/sdk/pull/16110 should resolve this. Waiting for this to flow to the installer to double confirm…

0reactions
captainsafiacommented, Mar 10, 2021

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:

  • Although this is a perf regression between preview2 bits, there’s still a pretty solid perf improvement between .NET 5 (our baseline) and 6.0.100-preview.3.21153.9.
  • We’ll eventually be replacing our caching mechanism by one provided by the compiler so this is a transient issue until we consume the right APIs.
  • We’re trying to avoid filesystem interaction in the source generator so we can’t go back to our old caching strategy.
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found