-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[.NET 8] perf regression in <LinkAssembliesNoShrink/>
#7684
Comments
This step is converting old Resource.designer.cs code over to the new system. So once Maui has switched over to using the newer system it should be better as it will have less work to do. |
Yeah, we can keep an eye and test again when we have a new MAUI. What made me think something else is going on, is this target builds partially:
So in theory it should only be looking at |
It is buiding partially. but the Task in the target is not using any of the "partial" calculated ItemGroups
Its using |
Previously The "partial" part is:
|
Fixes: dotnet#7684 Comparing .NET 7 to main, I noticed: .NET 7 Task LinkAssembliesNoShrink 4ms main/.NET 8 Task LinkAssembliesNoShrink 101ms Under `dotnet trace` a lot of the time was spent in: 94.74ms MonoDroid.Tuner.FixLegacyResourceDesignerStep.LoadDesigner() Reviewing the code, I think we can "lazily" call the `LoadDesigner()` method. It creates a `Dictionary` that isn't used until the `FixBody()` method. I also updated one log message to only log duplicates, as it was logging hundreds of lines: if (output.ContainsKey (key)) { LogMessage ($" Found duplicate {key}"); } else { output.Add (key, property.GetMethod); } Which also showed up in `dotnet trace`: 25.58ms Microsoft.Android.Build.Tasks.MSBuildExtensions.LogDebugMessage() With these changes, I instead get: Task LinkAssembliesNoShrink 5ms Which is probably ~the same performance as before or plenty good enough!
If I'm reading the code right, I think this will fix this: #7686 But let's see if anything breaks? |
Fixes: dotnet#7684 Comparing .NET 7 to main, I noticed: .NET 7 Task LinkAssembliesNoShrink 4ms main/.NET 8 Task LinkAssembliesNoShrink 101ms Under `dotnet trace` a lot of the time was spent in: 94.74ms MonoDroid.Tuner.FixLegacyResourceDesignerStep.LoadDesigner() Reviewing the code, I think we can "lazily" call the `LoadDesigner()` method. Now it delays until the `ProcessAssemblyDesigner()` method. I had to reorder logic slightly to do this. I also updated one log message to only log duplicates, as it was logging hundreds of lines: if (output.ContainsKey (key)) { LogMessage ($" Found duplicate {key}"); } else { output.Add (key, property.GetMethod); } Which also showed up in `dotnet trace`: 25.58ms Microsoft.Android.Build.Tasks.MSBuildExtensions.LogDebugMessage() With these changes, I instead get: Task LinkAssembliesNoShrink 5ms Which is probably ~the same performance as before or plenty good enough! Lastly, I also removed some other code & members in `FixLegacyResourceDesignerStep` that Visual Studio showed me was unused.
Fixes: #7684 Comparing .NET 7 to main, I noticed: .NET 7 Task LinkAssembliesNoShrink 4ms main/.NET 8 Task LinkAssembliesNoShrink 101ms Under `dotnet trace` a lot of the time was spent in: 94.74ms MonoDroid.Tuner.FixLegacyResourceDesignerStep.LoadDesigner() Reviewing the code, I think we can "lazily" call the `LoadDesigner()` method. Now it delays until the `ProcessAssemblyDesigner()` method. I had to reorder logic slightly to do this. I also updated one log message to only log duplicates, as it was logging hundreds of lines: if (output.ContainsKey (key)) { LogMessage ($" Found duplicate {key}"); } else { output.Add (key, property.GetMethod); } Which also showed up in `dotnet trace`: 25.58ms Microsoft.Android.Build.Tasks.MSBuildExtensions.LogDebugMessage() With these changes, I instead get: Task LinkAssembliesNoShrink 5ms Which is probably ~the same performance as before or plenty good enough! Lastly, I also removed some other code & members in `FixLegacyResourceDesignerStep` that Visual Studio showed me was unused.
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
.NET 8 / main
Description
In .NET 7, in an old log I see:
This was an example of a
.xaml
change in adotnet new maui
project.Now I see:
dotnet trace
shows most of the time is:So I think we might need to rework parts of dc3ccf2, maybe it can skip some things on incremental builds?
Less log messages would also help:
Steps to Reproduce
dotnet new maui
.xaml
Did you find any workaround?
Set
$(AndroidUseDesignerAssembly)
tofalse
, would skip some of these steps.Relevant log output
msbuild.zip
The text was updated successfully, but these errors were encountered: