CARVIEW |
Select Language
HTTP/2 301
date: Sun, 27 Jul 2025 13:19:18 GMT
content-length: 0
location: https://github.com/dotnet/android/pull/6482
server-timing: nginx;desc="NGINX";dur=1.577355,glb;desc="GLB";dur=101.499267
x-voltron-version: a2eb102
vary: Accept-Encoding, Accept, X-Requested-With
server: github.com
x-frame-options: DENY
strict-transport-security: max-age=31536000; includeSubDomains; preload
set-cookie: _gh_sess=B4H1H9DzAsgqSyVh4O2u8FMj6goi0SGjOzcWt831vaDc8vrkIJSnuIsc5HlFqDnQJAYYShPW4IOu7kprXrBR12lcZH1tP99Usz2JEwAO0cYbIt2sLfo9KVVjyxMDn7V7sbvcFhgZoNL5hSSOZqckYzvYADVtoItR0g7dz9Vt4nCf3iMGfGTropIIYoDh8VJ5EXQEOENWkAiRJAeH47yVSYO3cbZt1205dLziWK%2FnnEnW0iAGUdobFgOa2ZgnPk4WXyVsU2UREkLhmM8u%2BGmuvQ%3D%3D--8RLs1xQpilrGGN8%2F--5gmyUxz4aPrfCdMcgVXKVA%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1401661304.1753622358; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 13:19:18 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 13:19:18 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 9C8A:3E3773:518F1B:6C69C2:68862756
HTTP/2 200
date: Sun, 27 Jul 2025 13:19:19 GMT
content-type: text/html; charset=utf-8
cache-control: no-cache
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
referrer-policy: no-referrer-when-downgrade
server-timing: pull_request_layout-fragment;desc="pull_request_layout fragment";dur=220.097813,conversation_content-fragment;desc="conversation_content fragment";dur=547.834607,conversation_sidebar-fragment;desc="conversation_sidebar fragment";dur=275.404716,nginx;desc="NGINX";dur=0.588427,glb;desc="GLB";dur=101.135394
strict-transport-security: max-age=31536000; includeSubdomains; preload
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-content-type-options: nosniff
x-frame-options: deny
x-voltron-version: a2eb102
x-xss-protection: 0
server: github.com
content-encoding: gzip
accept-ranges: bytes
x-github-request-id: 9C8A:3E3773:518F3D:6C69EB:68862756
[Xamarin.Android.Build.Tasks] Profiled AOT can Full AOT the main assembly by jonathanpeppers · Pull Request #6482 · dotnet/android · GitHub
jonathanpeppers
requested review from
dellis1972 and
jonpryor
as code owners
November 12, 2021 20:05
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 555
[Xamarin.Android.Build.Tasks] Profiled AOT can Full AOT the main assembly #6482
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
Merged
jonathanpeppers
merged 2 commits into
dotnet:main
from
jonathanpeppers:profiled-aot-main-assembly
Nov 16, 2021
Merged
[Xamarin.Android.Build.Tasks] Profiled AOT can Full AOT the main assembly #6482
jonathanpeppers
merged 2 commits into
dotnet:main
from
jonathanpeppers:profiled-aot-main-assembly
Nov 16, 2021
Conversation
This file contains hidden or 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
…mbly When using the built-in profiles for Profiled AOT, one drawback is the user's code isn't AOT'd. We only AOT types that are called in the BCL, `Java.Interop.dll`, `Mono.Android.dll`, etc. To make this better, we can full AOT the "main" assembly. Most code in users' main assembly would likely get called on startup. This should have a minor impact to `.apk` size, but gain us a better startup boost by default. When testing, I can see more methods AOT'd: 11-11 09:01:01.441 16386 16386 D Mono : AOT: FOUND method foo.MainActivity:OnCreate (Android.OS.Bundle) [0x7c050e8e20f0 - 0x7c050e8e213b 0x7c050e8e2673] ~~ Results ~~ A `dotnet new android` app, built with: > dotnet build -c Release -p:AndroidEnableProfiledAot=true -p:RunAOTCompilation=true -r android-arm64 -p:AndroidPackageFormat=apk File size: > apkdiff -f before.apk after.apk Size difference in bytes ([*1] apk1 only, [*2] apk2 only): + 5,632 lib/arm64-v8a/libaot-foo.dll.so + 5 assemblies/assemblies.blob Summary: + 5 Other entries 0.00% (of 787,048) + 0 Dalvik executables 0.00% (of 345,340) + 5,632 Shared libraries 0.09% (of 6,008,168) + 0 Package size difference 0.00% (of 3,169,571) 10 runs on a Pixel 5 was an average of 193ms before, and 192ms after (the `Activity Displayed` time). There may, in fact, not be a difference for `dotnet new android`. Next I installed .NET MAUI 6.0.101-preview.11.2149, and tried a `dotnet new maui` app: File size: > apkdiff -f before.apk after.apk Size difference in bytes ([*1] apk1 only, [*2] apk2 only): + 67,144 lib/arm64-v8a/libaot-foo.dll.so Summary: + 0 Other entries 0.00% (of 7,765,174) + 0 Dalvik executables 0.00% (of 6,443,152) + 67,144 Shared libraries 0.50% (of 13,388,688) + 20,480 Package size difference 0.14% (of 14,272,332) 10 runs on a Pixel 5: Before: Activity: Displayed 656ms Activity: Displayed 635ms Activity: Displayed 623ms Activity: Displayed 633ms Activity: Displayed 660ms Activity: Displayed 655ms Activity: Displayed 634ms Activity: Displayed 646ms Activity: Displayed 628ms Activity: Displayed 646ms Activity: Displayed 630ms ---------------------------------------------------------------- Average 641ms After: Activity: Displayed 679ms Activity: Displayed 644ms Activity: Displayed 607ms Activity: Displayed 620ms Activity: Displayed 623ms Activity: Displayed 615ms Activity: Displayed 619ms Activity: Displayed 623ms Activity: Displayed 617ms Activity: Displayed 631ms Activity: Displayed 623ms ---------------------------------------------------------------- Average 627ms I think this might help startup by ~14ms in a `dotnet new maui` app. It would likely improve more depending on the app.
dellis1972
reviewed
Nov 15, 2021
dellis1972
approved these changes
Nov 15, 2021
When using the built-in profiles for Profiled AOT, one drawback is
the user's code isn't AOT'd. We only AOT types that are called in
the BCL, `Java.Interop.dll`, `Mono.Android.dll`, etc.
To make this better, we can AOT the "main" assembly. Most code in
the users' main assembly would likely get called on startup. This
should have a minor impact to `.apk` size, but gain us a better
startup boost by default.
When testing, I can see more methods AOT'd:
11-11 09:01:01.441 16386 16386 D Mono : AOT: FOUND method foo.MainActivity:OnCreate (Android.OS.Bundle) [0x7c050e8e20f0 - 0x7c050e8e213b 0x7c050e8e2673]
~~ Results ~~
| Test | File Size (Δ) | Activity Displayed (Δ) |
| ------------------------------------- | ----------------: | ------------------------: |
| `dotnet new android` w/o AOT app | -baseline- | 193ms |
| `dotnet new android` *with* AOT app | (0%) | 192ms (99%) |
| `dotnet new maui` w/o AOT app | -baseline- | 641ms |
| `dotnet new maui` *with* AOT app | +20,480 (0.14%) | 627ms (98%) |
The `dotnet new android` app is built with:
> dotnet build -c Release -p:AndroidEnableProfiledAot=true -p:RunAOTCompilation=true -r android-arm64 -p:AndroidPackageFormat=apk
File size differences:
> apkdiff -f before.apk after.apk
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
+ 5,632 lib/arm64-v8a/libaot-foo.dll.so
+ 5 assemblies/assemblies.blob
Summary:
+ 5 Other entries 0.00% (of 787,048)
+ 0 Dalvik executables 0.00% (of 345,340)
+ 5,632 Shared libraries 0.09% (of 6,008,168)
+ 0 Package size difference 0.00% (of 3,169,571)
10 runs on a Pixel 5 was an average of 193ms before, and 192ms after
(the `Activity Displayed` time). There may not, in fact, be a
difference for `dotnet new android`.
Next I installed .NET MAUI 6.0.101-preview.11.2149, and tried a
`dotnet new maui` app:
File size:
> apkdiff -f before.apk after.apk
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
+ 67,144 lib/arm64-v8a/libaot-foo.dll.so
Summary:
+ 0 Other entries 0.00% (of 7,765,174)
+ 0 Dalvik executables 0.00% (of 6,443,152)
+ 67,144 Shared libraries 0.50% (of 13,388,688)
+ 20,480 Package size difference 0.14% (of 14,272,332)
Total file size difference:
--14,251,852
++14,272,332
The average over 10 runs on a Pixel 5, before applying this change,
is ~641ms. After applying this change, it's ~627ms.
I think this might help startup by ~14ms in a `dotnet new maui` app.
It would likely improve more depending on the app. |
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.
You can’t perform that action at this time.
When using the built-in profiles for Profiled AOT, one drawback is the
user's code isn't AOT'd. We only AOT types that are called in the BCL,
Java.Interop.dll
,Mono.Android.dll
, etc.To make this better, we can full AOT the "main" assembly. Most code in
users' main assembly would likely get called on startup. This should
have a minor impact to
.apk
size, but gain us a better startup boostby default.
When testing, I can see more methods AOT'd:
Results
A
dotnet new android
app, built with:File size:
10 runs on a Pixel 5 was an average of 193ms before, and 192ms after
(the
Activity Displayed
time). There may, in fact, not be adifference for
dotnet new android
.Next I installed .NET MAUI 6.0.101-preview.11.2149, and tried a
dotnet new maui
app:File size:
10 runs on a Pixel 5:
I think this might help startup by ~14ms in a
dotnet new maui
app.It would likely improve more depending on the app.