Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] lazily populate Resource lookup
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!
- Loading branch information