-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[android] add AOT profile for .NET MAUI #2496
Merged
jonathanpeppers
merged 1 commit into
dotnet:main
from
jonathanpeppers:android-profiled-aot
Sep 17, 2021
Merged
[android] add AOT profile for .NET MAUI #2496
jonathanpeppers
merged 1 commit into
dotnet:main
from
jonathanpeppers:android-profiled-aot
Sep 17, 2021
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
Hmm, there is no Android NDK on CI here:
Need to look into this. |
Context: dotnet/android@3e699d6 Context: https://github.com/jonathanpeppers/android-profiled-aot Add a `maui.aotprofile`, and bundle with .NET MAUI. Recording custom profiles is not supported by dotnet/runtime, but it can be done following the instructions in the jonathanpeppers/android-profiled-aot repo. To ship an AOT Profile for MAUI: 1. Default `$(AndroidUseDefaultAotProfile)` to `false`, so the plain Android profile is not used. The default Android profile only contains methods in AndroidX, Mono.Android.dll, Java.Interop.dll, etc. 2. Default `@(AndroidAotProfile)` to `maui.aotprofile`, unless `$(MauiUseDefaultAotProfile)` is `false`. ~~ Profile Contents ~~ Modules: EA3844FC-D728-4D48-9598-1C93505E4623 System.Private.CoreLib 2CC403AF-60DC-48A9-9B69-FF254277AEA0 Mono.Android 92FF7068-2EA9-4681-B340-44E91077417A Java.Interop 3E65EB5C-02E9-4DE5-AC19-B2F2BAF2857B Microsoft.Maui.Essentials 21CF52B7-0256-4838-848C-DA026B2F1789 Xamarin.AndroidX.Core 35358E14-E381-4472-858E-ABFD81B3517C Microsoft.Maui 5A334DAA-789C-421E-9B20-F1B66879BF49 Microsoft.Extensions.Hosting C3C04DA6-9F0C-48FD-83EA-115CB6076248 Microsoft.Extensions.DependencyInjection 1CC454CF-BE07-4D95-B1E7-3EFC458F943C Microsoft.Extensions.DependencyInjection.Abstractions 229E3EBA-F00D-40DF-BEB8-4C16CB84DE98 Microsoft.Extensions.Configuration.Abstractions CCAA9BA7-D5D3-47EC-8FBB-DED7D6FC2143 Microsoft.Extensions.Configuration 981BD5D2-69A5-4C0B-A258-50BB28365D5B Microsoft.Extensions.Primitives C674A867-6352-482C-9A7A-0272480711AC Microsoft.Extensions.Hosting.Abstractions 1D537869-4CC1-4E6D-B0BF-6ABEA40ADF8B Microsoft.Extensions.Configuration.FileExtensions 3C68719B-EA9F-48EC-86D7-2EE85CDA2272 Microsoft.Extensions.FileProviders.Physical 0D1C05F9-FFB8-4A75-A24E-6C17893B53F7 System.Linq DCE2ADDD-008E-43B4-B1D6-3CCA222678FF Microsoft.Extensions.Logging C9E0059C-3CE2-4B91-BE1D-808EF93495C3 Microsoft.Extensions.Options 8A3A36B0-0D51-4CF6-A5F0-2E1EF0A01648 Microsoft.Extensions.Logging.Abstractions DDC70C0B-3BAA-4844-8401-65EA77FBDDDC Microsoft.Extensions.Logging.Configuration 28AB2955-BA00-4EAC-90B6-4E31F4826D75 Microsoft.Extensions.Options.ConfigurationExtensions BC607A7F-080C-424F-8A37-011B30F6DE55 Microsoft.Extensions.Logging.Console 1BDE760B-6269-47BC-9BF5-6B44DC9CC032 Microsoft.Extensions.Logging.Debug 9D7AA4B2-70B7-4329-A099-BE5F3B8FE0A4 Microsoft.Extensions.Logging.EventSource DF5F5616-FA06-46C0-8025-6DA20BB34CEC Microsoft.Maui.Controls.Compatibility 63B89754-AAED-4092-9FDE-E50EB969DE1B MauiApp1 1F1E6C61-F9BC-488D-9EC4-335D0D5A0800 Microsoft.Maui.Graphics 38104510-26A0-4B40-8542-80153806B860 System.Diagnostics.DiagnosticSource F7E05AD1-4195-4539-B3AD-487030D94748 System.Collections.Concurrent 2795C489-C1E7-40BC-ACF2-B84C11F67B47 Microsoft.Extensions.Configuration.Binder F26C0583-5BFE-4B78-BC65-84547BAA9F75 System.Runtime.InteropServices.RuntimeInformation 404F6169-7356-4D95-BD9A-3A5C7D88BD6E System.Console CD148B87-3553-48A2-8853-CEC72437F2A2 Microsoft.Maui.Controls 99F9B89D-EF4E-4F6B-B785-56AFD6E37113 Microsoft.Maui.Controls.Xaml 1B55562C-5DD7-4779-8473-8B4558C8D065 System.ComponentModel.TypeConverter 43402C13-3212-4B9C-8A1C-0BA8C6AC6F29 System.ObjectModel 8766384A-BB06-42DA-810C-B5B2B0D7C971 System.Private.Xml 82E0E2F3-002E-4780-BEC2-E230299A5ED2 System.Private.Uri 7CEE6098-BE9F-4043-B35A-B8B0684EF0CB Xamarin.AndroidX.AppCompat 20D1FBB8-829A-4618-8E82-8047C8827EA8 Xamarin.AndroidX.Fragment CC363D7A-9CDB-4999-9E10-279412B14A1B Xamarin.AndroidX.Activity 008C0F24-5014-4D41-AAB9-DDFCEA59E171 Xamarin.Google.Android.Material Summary: Modules: 42 Types: 1,234 Methods: 5,030 ~~ Results ~~ All tests: 1. Were running on a [Google Pixel 5][0], and 2. Enabled two architectures, arm64 and x86, and 3. **JIT time** was average of 10 runs with `-c Release`, no AOT 4. **AOT time** was average of 10 runs with `-c Release -p:RunAOTCompilation=true`, with the`Activity: Displayed` time 5. **Profiled AOT time** was average of 10 runs with `-c Release -p:RunAOTCompilation=true -p:AndroidEnableProfiledAot=true` with the `Activity: Displayed` time. | | [AndroidApp1][1] | [MauiApp1][2] | | ----------------------------------: | ------------------: | ----------------: | | JIT startup time (s) | 00:00.4387 | 00:01.4205 | | AOT startup time (vs. JIT) | 00:00.3317 ( 76%) | 00:00.7285 ( 51%) | | Profiled AOT startup time (vs. JIT) | 00:00.3093 ( 71%) | 00:00.7098 ( 50%) | | JIT `.apk` size (B) | 9,155,954 | 17,435,225 | | AOT `.apk` size (vs. JIT) | 12,755,672 (139%) | 44,751,651 (257%) | | Profiled AOT `.apk` size (vs. JIT) | 9,777,880 (107%) | 23,210,787 (133%) | [0]: store.google.com/us/product/pixel_5_specs?hl=en-US [1]: jonathanpeppers/android-profiled-aot@e48c6df/AndroidApp1 [2]: jonathanpeppers/android-profiled-aot@e48c6df/MauiApp1
c61ddce
to
08176a5
Compare
I didn't add something to CI for this, because we'd need to download/install the Android NDK. So I manually tested:
I see in the
The
|
mattleibow
approved these changes
Sep 17, 2021
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: dotnet/android@3e699d6
Context: https://github.com/jonathanpeppers/android-profiled-aot
Add a
maui.aotprofile
, and bundle with .NET MAUI. Recording customprofiles is not supported by dotnet/runtime, but it can be done
following the instructions in the jonathanpeppers/android-profiled-aot
repo.
To ship an AOT Profile for MAUI:
$(AndroidUseDefaultAotProfile)
tofalse
, so the plainAndroid profile is not used. The default Android profile only
contains methods in AndroidX, Mono.Android.dll, Java.Interop.dll, etc.
@(AndroidAotProfile)
tomaui.aotprofile
, unless$(MauiUseDefaultAotProfile)
isfalse
.Profile Contents
Results
All tests:
-c Release
, no AOT-c Release -p:RunAOTCompilation=true
, with theActivity: Displayed
time-c Release -p:RunAOTCompilation=true -p:AndroidEnableProfiledAot=true
withthe
Activity: Displayed
time..apk
size (B).apk
size (vs. JIT).apk
size (vs. JIT)PR Checklist
Does this PR touch anything that might affect accessibility?
No