Skip to content
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] update .aotprofile for .NET 9 RC 2 #25035

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

jonathanpeppers
Copy link
Member

I recorded these with the 35.0.0-rc.2.145 Android workload as there was one change that disables $(AndroidEnableMarshalMethods) that impacts .aotprofile files:

With this change in place, managed C# methods like these will reappear in the profile:

bool Android.Runtime.AndroidTypeManager:FastRegisterNativeMembers (Java.Interop.JniType,System.Type,System.ReadOnlySpan`1<char>)
...
bool Android.Runtime.JNINativeWrapper:Wrap_JniMarshal_PPJ_Z (_JniMarshal_PPJ_Z,intptr,intptr,long)
bool Android.Runtime.JNINativeWrapper:Wrap_JniMarshal_PPL_Z (_JniMarshal_PPL_Z,intptr,intptr,intptr)
bool Android.Runtime.JNINativeWrapper:Wrap_JniMarshal_PPLLJ_Z (_JniMarshal_PPLLJ_Z,intptr,intptr,intptr,intptr,long)
...
System.Delegate Android.App.Activity:GetOnActivityResult_IILandroid_content_Intent_Handler ()
System.Delegate Android.App.Activity:GetOnBackPressedHandler ()

In the future, we hope to bring back $(AndroidEnableMarshalMethods) once the known issues are worked out.

Measuring the new profile on a Pixel 7 Pro, an average of 10 runs of the dotnet new maui project template:

Before:
Average(ms): 475.2
Std Err(ms): 3.96316371938716
Std Dev(ms): 12.5326240934078
After:
Average(ms): 447.1
Std Err(ms): 1.75404294892305
Std Dev(ms): 5.54677083235522

So, this change likely avoids some startup regression on Android, as the C# methods that run on startup when
AndroidEnableMarshalMethods=false are now AOT-compiled.

I also added -bl to the README.md, as I thought that was useful.

I recorded these with the `35.0.0-rc.2.145` Android workload as there
was one change that disables `$(AndroidEnableMarshalMethods)` that
impacts `.aotprofile` files:

* dotnet/android@afb5f7e

With this change in place, managed C# methods like these will reappear
in the profile:

    bool Android.Runtime.AndroidTypeManager:FastRegisterNativeMembers (Java.Interop.JniType,System.Type,System.ReadOnlySpan`1<char>)
    ...
    bool Android.Runtime.JNINativeWrapper:Wrap_JniMarshal_PPJ_Z (_JniMarshal_PPJ_Z,intptr,intptr,long)
    bool Android.Runtime.JNINativeWrapper:Wrap_JniMarshal_PPL_Z (_JniMarshal_PPL_Z,intptr,intptr,intptr)
    bool Android.Runtime.JNINativeWrapper:Wrap_JniMarshal_PPLLJ_Z (_JniMarshal_PPLLJ_Z,intptr,intptr,intptr,intptr,long)
    ...
    System.Delegate Android.App.Activity:GetOnActivityResult_IILandroid_content_Intent_Handler ()
    System.Delegate Android.App.Activity:GetOnBackPressedHandler ()

In the future, we hope to bring back `$(AndroidEnableMarshalMethods)`
once the known issues are worked out.

Measuring the new profile on a Pixel 7 Pro, an average of 10 runs of
the `dotnet new maui` project template:

    Before:
    Average(ms): 475.2
    Std Err(ms): 3.96316371938716
    Std Dev(ms): 12.5326240934078
    After:
    Average(ms): 447.1
    Std Err(ms): 1.75404294892305
    Std Dev(ms): 5.54677083235522

So, this change likely avoids some startup regression on Android, as
the C# methods that run on startup when
`AndroidEnableMarshalMethods=false` are now AOT-compiled.

I also added `-bl` to the `README.md`, as I thought that was useful.
@rmarinho
Copy link
Member

rmarinho commented Oct 1, 2024

/backport to release/9.0.1xx-rc2

Copy link
Contributor

github-actions bot commented Oct 1, 2024

Started backporting to release/9.0.1xx-rc2: https://github.com/dotnet/maui/actions/runs/11134020867

@rmarinho rmarinho merged commit b7845f6 into dotnet:net9.0 Oct 2, 2024
119 of 121 checks passed
@samhouts samhouts added the fixed-in-net9.0-nightly This may be available in a nightly release! label Oct 14, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-net9.0-nightly This may be available in a nightly release!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants