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]
FixAbstractMethodsStep
performance (#…
…8650) Context: #8421 Working a bit on build performance, I tested: * `dotnet new maui` * `dotnet build -bl` The `.binlog` shows: LinkAssembliesNoShrink 3.797s Attaching `dotnet-trace` as mentioned on: https://github.com/xamarin/xamarin-android/blob/2f192386e8072f8e0ecaf0de2fe48654f3ade423/Documentation/guides/tracing.md#how-to-dotnet-trace-our-build I see time broken down such as: FixAbstractMethods: 37% AssemblyDefinition.Write: 27% ProcessAssemblyDesigner: 20% CopyIfChanged: 13% DirectoryAssemblyResolver.GetAssembly: 4.4% This made me focus in on `FixAbstractMethodsStep` and make the following changes: * All calls for `TypeReference.Resolve()` and `MethodReference.Resolve()` should go through the `TypeDefinitionCache` to avoid repeated lookups. * `IsInOverrides()` can compare the `MethodReference.Name` before calling `Resolve()`. It could resolve many unnecessary methods otherwise. After these changes, I instead see from `dotnet-trace`: --1.45s (3.7%) xamarin.android.build.tasks!MonoDroid.Tuner.FixAbstractMethodsStep.FixAbstractMethods() ++949.70ms (2.5%) xamarin.android.build.tasks!MonoDroid.Tuner.FixAbstractMethodsStep.FixAbstractMethods() Time is now broken down differently, such as: AssemblyDefinition.Write: 31% FixAbstractMethods: 28% ProcessAssemblyDesigner: 23% CopyIfChanged: 12% DirectoryAssemblyResolver.GetAssembly: 4.8% In an overall `.binlog` (without `dotnet-trace` attached): --LinkAssembliesNoShrink 3.797s ++LinkAssembliesNoShrink 3.105s This saved ~700ms on initial build of a new MAUI project.
- Loading branch information