-
Notifications
You must be signed in to change notification settings - Fork 531
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
[Xamarin.Android.Build.Tasks] FixAbstractMethodsStep
performance
#8650
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context: dotnet#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.
Ignore the MAUI lane for now, I think their build is broken:
|
grendello
added a commit
that referenced
this pull request
Feb 7, 2024
* main: [Xamarin.Android.Build.Tasks] `FixAbstractMethodsStep` performance (#8650)
grendello
added a commit
that referenced
this pull request
Feb 8, 2024
* main: Bump to xamarin/monodroid@848d1277b7 (#8691) [Xamarin.Android.Build.Tasks] `FixAbstractMethodsStep` performance (#8650)
grendello
added a commit
that referenced
this pull request
Feb 13, 2024
* main: [Xamarin.Android.Build.Tasks] remove `$(AndroidSupportedAbis)` from `build.props` (#8717) [Xamarin.Android.Build.Tasks] BannedApiAnalyzers for Resolve() (#8715) Bump to xamarin/Java.Interop/main@dfcbd670 (#8714) [monodroid] C++ tweaks and legacy code cleanup (#8638) Bump to xamarin/xamarin-android-tools/main@a698a33 (#8710) [readme] Add `d17-8` download links. (#8709) Bump external/Java.Interop from `07c7300` to `7f08b77` (#8702) Bump to xamarin/monodroid@848d1277b7 (#8691) [Xamarin.Android.Build.Tasks] `FixAbstractMethodsStep` performance (#8650) Bump to dotnet/installer@fb7b9a4b9e 9.0.100-preview.2.24106.6 (#8700)
grendello
added a commit
that referenced
this pull request
Feb 14, 2024
* main: (116 commits) [tmt] Update to work with current `libxamarin-app.so` (#8694) [Xamarin.Android.Build.Tasks] remove `$(AndroidSupportedAbis)` from `build.props` (#8717) [Xamarin.Android.Build.Tasks] BannedApiAnalyzers for Resolve() (#8715) Bump to xamarin/Java.Interop/main@dfcbd670 (#8714) [monodroid] C++ tweaks and legacy code cleanup (#8638) Bump to xamarin/xamarin-android-tools/main@a698a33 (#8710) [readme] Add `d17-8` download links. (#8709) Bump external/Java.Interop from `07c7300` to `7f08b77` (#8702) Bump to xamarin/monodroid@848d1277b7 (#8691) [Xamarin.Android.Build.Tasks] `FixAbstractMethodsStep` performance (#8650) Bump to dotnet/installer@fb7b9a4b9e 9.0.100-preview.2.24106.6 (#8700) [Mono.Android] Cache `Profiles/api-34.xml` contents (#8679) [monodroid] typemaps may need to load assemblies (#8625) Bump $(AndroidNetPreviousVersion) to 34.0.79 (#8693) Bump to xamarin/java.interop/main@07c73009 (#8681) Bump to dotnet/installer@1c496970b7 9.0.100-preview.2.24078.1 (#8685) [GetAndroidDependencies] Add Jdk dependency info (#8651) [xaprepare] Add support for newer SparkyLinux (#8684) Bump to dotnet/installer@5680e93cb2 9.0.100-preview.2.24073.12 (#8666) $(AndroidPackVersionSuffix)=preview.2; net9 is 34.99.0.preview.2 (#8678) ...
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: #8421
Working a bit on build performance, I tested:
dotnet new maui
dotnet build -bl
The
.binlog
shows: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:
This made me focus in on
FixAbstractMethodsStep
and make the following changes:All calls for
TypeReference.Resolve()
andMethodReference.Resolve()
should go through theTypeDefinitionCache
to avoid repeated lookups.IsInOverrides()
can compare theMethodReference.Name
before callingResolve()
. It could resolve many unnecessary methods otherwise.After these changes, I instead see from
dotnet-trace
:Time is now broken down differently, such as:
In an overall
.binlog
(withoutdotnet-trace
attached):This saved ~700ms on initial build of a new MAUI project.