maui icon indicating copy to clipboard operation
maui copied to clipboard

AOT everything is not AOTing everything

Open sake402 opened this issue 3 years ago • 1 comments
trafficstars

Description

If my understanding of AOT is correct, the assemblies are already compiled to native codes and I can confirm this with all the .so file in the apk.

However when doing performance check with dotnet-trace, I still see a lot of JIT being done killing the startup time of the app. The apk is built for AOT everything in release mode with

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
        <RunAOTCompilation>true</RunAOTCompilation>
        <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
    </PropertyGroup>

But yet there is a lot of System.Private.CoreLib!System.Runtime.CompilerServices.RuntimeHelpers.CompileMethod(object) in the call stack taking good amount of time.

dotnet --version
6.0.400

Steps to Reproduce

Create a new dotnet new maui app

Add to csproj

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
        <RunAOTCompilation>true</RunAOTCompilation>
        <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
    </PropertyGroup>

Run

adb reverse tcp:9000 tcp:9001
adb shell setprop debug.mono.profile '127.0.0.1:9000,suspend'
start cmd.exe @cmd /k "dotnet-dsrouter client-server -tcps 127.0.0.1:9001 -ipcc /tmp/maui-app --verbose debug"
start cmd.exe @cmd /k "dotnet-trace collect --diagnostic-port /tmp/maui-app --format speedscope"
dotnet build --no-restore -f net6.0-android -t:Run -c Release -p:AndroidEnableProfiler=true

Link to public reproduction project repository

https://gist.github.com/sake402/17462ea30f2335c2d490049fbf0d4282

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 21

Did you find any workaround?

No response

Relevant log output

No response

sake402 avatar Sep 21 '22 12:09 sake402

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Sep 21 '22 18:09 ghost

This issue was moved to xamarin/xamarin-android#7723

Eilon avatar Jan 20 '23 19:01 Eilon