AOT compile mono libraries at install time

Registered by Chris Halse Rogers on 2012-05-04

Mono has the ability to generate code ahead of time and store this alongside the CIL image. This can significantly reduce startup time, allow sharing the in-memory code, and allow for more extensive optimisations to be performed.

Blueprint information

Not started
Sebastien Bacher
Chris Halse Rogers
Needs approval
Chris Halse Rogers
Series goal:
Accepted for raring
Milestone target:

Related branches



== Rationale ==
Desktop applications using the mono runtime suffer from poor startup times, particularly on slow CPUs. Running the JIT at install time rather than startup time can significantly improve this.

== Goal ==
Improve startup time of mono applications

== Test Plan ==
The mono runtime changes can be unittested, the packaging components will be tested with a rebuild/piuparts run.

== Release notes ==
The core mono libraries are now precompiled at install time, providing faster startup times and better memory sharing for mono applications.

Obvious place to put this is in dh_cliinstallgac - AOT compile needs to be run on the CPU that will be used
Possible blockers: OEM installs, with preinstalled packages
A possibility is to ship an AOT cache in the packages for a minimal CPU - this requires an unknown, but probably significant, patch to the JIT engine, which I don't want to do.
Invalidating the cached AOT code would require looking at the CPU capabilities & comparing that with what would be in the binary.
Approx 50 seconds to AOT everything on core i5, using 285MB disk space (230MB excluding IL code)

RAOF, 2012-07-06: Mono runtime patch to refuse to load AOT images with unsupported optimisations is upstream; we can't reasonably cherry pick, though. Moving the rest to R, where we should have the new mono.


Work Items

Work items:
[raof] Benchmark AOT on ARM: BLOCKED
[raof] Implement in the mono runtime a way to detect when the CPU capabilities change (record at AOT time, check at load): DONE
[raof] Implement method of regenererating the AOT cache when the CPU changes: POSTPONED
[raof] Add dh_cliaot call to appropriate library packages: POSTPONED

This blueprint contains Public information 
Everyone can see this information.