dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.22k stars 1.75k forks source link

Investigate ReadyToRun/CrossGen for Windows packs #11493

Open jonathanpeppers opened 1 year ago

jonathanpeppers commented 1 year ago

Description

Running PerfView during an incremental build on Windows, a decent amount of time is spent JIT-ing these assemblies when the actually MAUI app launches:

image

We should investigate if using ReadyToRun and if creating win-arm64, win-x86, and win-x64 architecture-specific packs will help. In theory it will reduce 500ms from the total app launch time (and total F5)

Testing a dotnet new mauilib class library, I can do:

<PublishReadyToRun>true</PublishReadyToRun>
<IncludeBuildOutput>false</IncludeBuildOutput>
...
<ItemGroup>
    <_RIDs Include="win-arm64;win-x64;win-x86" RID="%(Identity)" />
    <None Include="@(_RIDs->'$(OutputPath)\%(Identity)\publish\$(TargetName).dll')" Pack="true" PackagePath="runtimes\%(RID)\native\lib\$(TargetFramework)" />
</ItemGroup>

But then it feels a bit weird, you have to build in a specific order:

dotnet publish -c Release -r win-x86
dotnet publish -c Release -r win-x64
dotnet publish -c Release -r win-arm64
dotnet pack -c Release

Public API Changes

n/a

Intended Use-Case

Decrease "total F5 time" for Debug builds

ghost commented 1 year ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.