Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] update built-in AOT profiles (#6247)
Browse files Browse the repository at this point in the history
Context: https://github.com/radekdoulik/aotprofile-tool
Context: a3fb59a

After checking the status of our existing AOT profiles, they are quite
out of date!  They don't even have AndroidX packages in the profile.

To update "legacy" Xamarin.Android AOT profiles:

 1. Create the `Navigation Drawer App` template in VS 2022.
    It appears to be the most complicated template we have.
 2. Run: `msbuild -t:BuildAndStartAotProfiling -r`
 3. Wait for the app to launch fully.
 4. Run: `msbuild -t:FinishAotProfiling`
 5. Replace `src/Xamarin.Android.Build.Tasks/startup.aotprofile` with
    `custom.aprof`, created in step (4).

The only issue is that the project assembly `ProfiledAOT` is included
in the profile.  I used `aotprofile-tool` to remove this:

    > aotprofile-tool -sd --filter-module='^(?!ProfiledAOT)' custom.aprof -o startup.aotprofile

`custom.aprof` before:

	Modules:
	    401C5F5A-AA78-4AC8-9C96-28B1BC912121 mscorlib
	    F60450ED-3217-41BF-8F49-05AB02A7C340 Mono.Android
	    058B5AF1-F84C-4B03-BE24-C3C6DFCC1CD0 System
	    3E31FA02-AF05-4AD6-9F07-7FA8D1D8B1C7 Java.Interop
	    77EFA9FA-E91E-43C7-A013-84A1AA042C34 System.Core
	    81E8A8C3-C4AF-49B8-9F48-319C0125F39F Xamarin.Android.Support.v7.AppCompat
	    BF568AED-5C7F-4B02-955A-BB8479029F7B Xamarin.Android.Support.Fragment
	    86A60DF4-5826-41BD-8A9D-6D2DD83D3638 Xamarin.Essentials
	    E87F1DC0-363D-41AD-BA63-52D7176A067A Xamarin.Android.Support.Design
	Summary:
	    Modules:          9
	    Types:          219
	    Methods:        929

`startup.aotprofile` after:

	Modules:
	    1B39A03C-32EC-4625-8A78-21E202E0269F mscorlib
	    67243B59-173F-4FA8-9DD1-04F9AF283BA6 Mono.Android
	    E3B6AD75-0143-4659-B50B-5395301B3720 System
	    271FC2D6-B26D-4B38-B0F5-76AB844A08B8 Java.Interop
	    60F07FDE-8264-428D-B7AF-82A82F994A86 Xamarin.Essentials
	    167F1C12-71D9-4405-A202-1C27E02B5AA0 Xamarin.AndroidX.Core
	    7029CC8C-D1A3-4419-8ECE-94FC236BE728 Xamarin.Google.Android.Material
	    B8BCF56D-F3B1-460C-A6D6-AA2BC755A6D0 Xamarin.AndroidX.AppCompat
	    C6D0193D-D634-4D22-BF83-E21E5BA870F0 Xamarin.AndroidX.Fragment
	    994A18E4-380A-445B-8745-22EDC7618921 Xamarin.AndroidX.Activity
	    D9805C2A-2D5C-4183-8F6F-0A9EE3736CCE Xamarin.AndroidX.DrawerLayout
	Summary:
	    Modules:         11
	    Types:          211
	    Methods:        862

I repeated this process with the `Xamarin.Forms Flyout` template:

`startup-xf.aotprofile` before:

	Modules:
	    41C38B0A-2032-45CE-8638-0299CED65330 mscorlib
	    0326DF03-2158-4F7A-9A2B-B7A9419F021D Mono.Android
	    8FB63BB4-1195-4173-A9ED-0EC341B07C32 System
	    74C06E06-C1C7-4A4C-B64E-EAC7DBB08BBC Java.Interop
	    11E2319F-6A26-461C-9C46-C972248BEE4B System.Core
	    7999CC4B-D566-4ECA-8A72-469344172CA3 Xamarin.Forms.Platform.Android
	    D754F8AE-503C-41C8-B16F-647FC662507A Xamarin.Android.Support.v7.AppCompat
	    929ECB6D-1171-4C66-8470-DD32AC608969 Xamarin.Android.Support.Fragment
	    F841E23B-59A8-4AE2-9A84-D2FC1D891B4A Xamarin.Forms.Core
	    C5089213-328B-451D-BA87-D6585C120780 Xamarin.Forms.Performance.Integration.Droid
	    945CCBF8-C2DB-468B-B3BD-D7ACA37B69AD Xamarin.Forms.Performance.Integration
	    AF20FA19-F07E-4BD4-B5ED-104706EA660E Xamarin.Forms.Xaml
	    629C84F8-0988-42EF-8BC5-872173A0A71F FormsViewGroup
	    60398815-8E62-487E-A553-781F56A0849D Xamarin.Android.Support.Design
	    F0C550D7-665A-40B5-A307-8E9B49976D87 Xamarin.Android.Support.Core.UI
	    23A34485-DE75-440E-BA9D-E235F664E990 Xamarin.Android.Support.Compat
	Summary:
	    Modules:         16
	    Types:          904
	    Methods:      4,220

`startup-xf.aotprofile` after:

	Modules:
	    1B39A03C-32EC-4625-8A78-21E202E0269F mscorlib
	    67243B59-173F-4FA8-9DD1-04F9AF283BA6 Mono.Android
	    E3B6AD75-0143-4659-B50B-5395301B3720 System
	    271FC2D6-B26D-4B38-B0F5-76AB844A08B8 Java.Interop
	    60F07FDE-8264-428D-B7AF-82A82F994A86 Xamarin.Essentials
	    E7DB99FB-7B1E-4E41-994C-209BB68FCCB3 Xamarin.AndroidX.Core
	    25214D64-3F8B-4B97-A15B-CDB62359E8E5 Xamarin.Forms.Platform.Android
	    757D4455-2835-4317-B274-847966166CE8 Xamarin.AndroidX.AppCompat
	    F41F1027-8409-4FA5-86A1-5D45DCF87D88 Xamarin.AndroidX.Fragment
	    359934D3-091D-4772-A09D-12B09E34EF2B Xamarin.AndroidX.Activity
	    2B518444-2493-4530-9542-DAED2E208536 System.Core
	    978EC34C-5C9C-4C4E-B3D7-3B6DA958BCD6 Xamarin.Forms.Core
	    0FC59C41-832E-4EA8-8954-727766860C45 Xamarin.Forms.Platform
	    804F4C0D-38D4-422E-B260-03CB4065D911 Xamarin.Forms.Xaml
	    C0B58365-A0EB-4524-AE0D-E3AC3172D695 Xamarin.AndroidX.DrawerLayout
	    2D0B56CD-BDA3-4128-A030-3C78B9F65B03 Xamarin.Google.Android.Material
	    BAA5FEB3-1182-4D89-A5BD-4978A57DBF30 Xamarin.AndroidX.CoordinatorLayout
	    2AD99D4F-F8BF-4697-9E52-D9BCDAC6318E Xamarin.AndroidX.RecyclerView
	    EF39F560-711B-4C25-AAB0-3920FD2A0180 Xamarin.AndroidX.ViewPager
	    2B783A37-ED84-415E-B075-C07234B75639 FormsViewGroup
	    A81DF736-5642-44E7-90DB-CE2ABD675E76 Xamarin.AndroidX.AppCompat.AppCompatResources
	Summary:
	    Modules:         21  (of 23)
	    Types:        1,107  (of 1204)
	    Methods:      5,600  (of 5624)

The results of using the old AOT Profiles on these projects vs the
new AOT Profile, a 10-run average, on a Pixel 5:

| Template Name         |  Old Profile Time |  New Profile Time |    (New/Old)% |
| --------------------- | ----------------: | ----------------: | ------------: |
| Navigation Drawer App |      00:00:00.360 |      00:00:00.263 |           73% |
| Xamarin.Forms Flyout  |      00:00:01.141 |      00:00:00.691 |         60.5% |
  • Loading branch information
jonathanpeppers committed Sep 1, 2021
1 parent fe2e7e6 commit e9a4c9f
Show file tree
Hide file tree
Showing 3 changed files with 1,491 additions and 1,491 deletions.
Binary file modified src/Xamarin.Android.Build.Tasks/startup-xf.aotprofile
Binary file not shown.
Binary file modified src/Xamarin.Android.Build.Tasks/startup.aotprofile
Binary file not shown.

0 comments on commit e9a4c9f

Please sign in to comment.