Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[One .NET] built-in Profiled AOT support
Fixes: #6053 This enables the ability to set: <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <RunAOTCompilation>true</RunAOTCompilation> <AndroidEnableProfiledAot>true</AndroidEnableProfiledAot> </PropertyGroup> And a default `dotnet.aotprofile` will be passed to the `<MonoAOTCompiler/>` MSBuild task. There will not be a way to "record" profiles in the Android workload in .NET 6. This is because it relies on legacy Mono infrastructure that is not implemented in .NET 6. I created a Github repo for recording profiles, where I committed the necessary binaries such as `aprofutil` and `libmono-profiler-aot.so`: https://github.com/jonathanpeppers/android-profiled-aot I recorded a `dotnet.aotprofile` with the contents: Modules: 6799590C-2963-4835-AEDC-20C67D875132 System.Private.CoreLib 2CC403AF-60DC-48A9-9B69-FF254277AEA0 Mono.Android 92FF7068-2EA9-4681-B340-44E91077417A Java.Interop 008C0F24-5014-4D41-AAB9-DDFCEA59E171 Xamarin.Google.Android.Material 7CEE6098-BE9F-4043-B35A-B8B0684EF0CB Xamarin.AndroidX.AppCompat 20D1FBB8-829A-4618-8E82-8047C8827EA8 Xamarin.AndroidX.Fragment CC363D7A-9CDB-4999-9E10-279412B14A1B Xamarin.AndroidX.Activity 21CF52B7-0256-4838-848C-DA026B2F1789 Xamarin.AndroidX.Core D1DE5607-BC27-45FC-93EC-0542C787E5FF Xamarin.AndroidX.DrawerLayout Summary: Modules: 9 Types: 229 Methods: 1,010 `AndroidApp1` is the `Navigation Drawer App` template from "legacy" Xamarin.Android. I ported this template to .NET 6 and dropped usage of Xamarin.Essentials. I thought this was a good target for a default profile, because of its heavy usage of AndroidX and Google Material. In a future PR, I will add a default AOT profile for .NET MAUI to be shipped inside the `maui` workload. ~~ 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. | Test | JIT time | AOT time | Profiled AOT time | JIT apk size | AOT apk size | Profiled AOT apk size | | ------------------ | ----------: | ----------: | ----------------: | ------------: | ------------: | --------------------: | | [AndroidApp1][1] | 00:00.4387 | 00:00:3317 | 00:00.3093 | 9,155,954 | 12,755,672 | 9,777,880 | | [MauiApp1][2] | 00:01.4205 | 00:00:7285 | 00:00.7098 | 17,435,225 | 44,751,651 | 23,210,787 | [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
- Loading branch information