What is AOT compilation and how does it affect MAUI performance and size?
Short answer
Ahead-of-time compilation converts IL to native code at build time, improving startup and steady-state performance and enabling smaller, trim-friendly binaries. iOS always uses AOT; Android can use startup tracing/AOT; Native AOT is emerging for MAUI.
Advertisement
AModel answer
Ahead-of-time compilation converts IL to native code at build time, improving startup and steady-state performance and enabling smaller, trim-friendly binaries. iOS always uses AOT; Android can use startup tracing/AOT; Native AOT is emerging for MAUI. AOT requires trim-safe, reflection-light code.
<PropertyGroup>
<RunAOTCompilation>true</RunAOTCompilation>
<AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
</PropertyGroup>Real-world example
Enabling profiled AOT on Android improves launch time by precompiling the hot startup paths.
Likely follow-ups
- Why does AOT need trim-safe code? | Does iOS require AOT?
Related topics