AOT你的程序集/代码不会改变应用程序初始化的启动(本机应用程序引导程序Xamarin / Mono初始化但不包括任何代码执行时间).
现在,如果你正在进行X代码中的CPU工作量,比如OnCreate(你真的不应该这样做),你会(应该)看到总时间的减少.我说应该由于AOT’ing并不能保证你会看到特定部分代码的执行时间更快,它确实消除了抖动,但还有很多其他因素.我已经使用Mono(AOT w /& w / o LLVM)多年了,你真的需要对你的代码进行测试和测试.
Although the JIT mode is very fast, and the default optimizations in Mono have been tuned to provide a good balance between optimizations and JIT speed, AOT compilation provides a few extra benefits:
Reduced startup time.
注意:这对于可能需要在运行之前执行大量代码的大型程序特别有用…
Potential better performance.
注意:……这意味着某些程序可能运行速度较慢,因为生成的代码比JIT可以生成的特定代码更通用.
启用LLVM和AOT来测试发布版本:
在优化AOT代码方面,在发布版本中启用LLVM和AOT以进行性能/仪器测试.注意:测试是关键,拥有完整的应用程序测试套件和内部工具来收集运行时性能是获得应用程序商店的5星评价的关键;-)
EnableLLVM
A boolean property that determines whether or not LLVM will be used when Ahead-of-Time compiling assemblines into native code.
Support for this property was added in Xamarin.Android 5.1.
This property is False by default.
This property is ignored unless the $(AotAssemblies) MSBuild property is True.
AotAssemblies
A boolean property that determines whether or not assemblies will be Ahead-of-Time compiled into native code and included in the .apk.
Support for this property was added in Xamarin.Android 5.1.
This property is False by default.