Translation of an article devoted to the new Adobe AIR compilation mode, which allows compiling iOS applications faster, without sacrificing the performance of the application under test. This publication also clearly shows the mechanism of the old and new compilers, a comparison table and key differences in the compilation processes.
Link to the original:
"Faster compiling with AIR for iOS"Introduction
AIR applications for iOS can be packaged in several ways, using the Fast packaging option (interpreted mode) or Standard (compiled mode) packaging. The interpreted mode, which is primarily used for debugging, compiles faster than the compiled mode. Although much of the development and testing can be performed using the interpreted mode, the performance at runtime is worse than when using the compiled mode. Developers publishing applications in the AppStore use compiled mode for better performance. However, the long time required for packaging in compiled mode does not cause positive emotions.
AIR provides a re-designed compiled packing mode that seeks to significantly reduce packing time while maintaining the same performance at run time. The beta version of the redesigned compiler is currently available to all developers. (in this case we are talking about AIR4, aIR 12)
')
Compile Mode OverviewWhen packaging an AIR application for iOS:
Developer SWF file is analyzed to extract Action Script Bytecode (abc) blocks.
After analyzing the contents of abc, and using
the LLVM API, each AS function is translated into the corresponding native function.
Using the code generator LLVM, an object file is generated for the target platform.
An executable file is created, linking the object files and the AIR Runtime libraries.
The iOS platform does not support dynamically loaded executable code. This limitation, however, allows the AIR wrapper to use optimization methods to increase performance at run time. This optimization is possible because all the code is available at compile time. See Figure 1 for an example of packaging an AIR application in compiled mode.

Fig. one
Legacy v / s compiler New compilerThe new compiler is created on top of the Action Script virtual machine. Next is a comparison of the redesigned compiler and the outdated compiler.
Old compiler | New compiler |
---|
Developed using Java and interacted with LLVM using JNI, thus badly affecting performance. | Developed using C ++ and most of its code is taken from a virtual machine. |
Generates a function call for each opcode (abc opcode). | Converts an opcode (abc opcode) to IR-based SSA (intermediate presentation) and generates an optimized IR. |
Compiles the built-in library every time the application is packaged. | Performs incremental compilation, which means that the built-in library is compiled only once and comes with the AIR SDK. |
See Figures 2 and 3 for an illustration of the changes in the redesigned compiler.

Fig. 2

Fig. 3
Use new packaging mode
In AIR 14, you can use any of the following methods to start using the new compiler.
Command lineTo start using the new compiler to package your IPA, use the –useLegacyAOT parameter and set its value to no:
<AIR SDK>/bin/adt -package -target ipa-app-store -useLegacyAOT no -provisioning-profile abc.mobileprovision -storetype pkcs12 -keystore abc.p12 HelloWorld.ipa HelloWorld-app.xml HelloWorld.swf
Flash builderTo use this feature in Flash Builder 4.7:
1. Click Project> Debug / Run> Debug Configurations / Run Configurations.
2. Click Customize Launch in the Debug Configurations dialog box.
The Customize Launch Parameters window displays all the parameters passed to the ADT along with their values. See Figure 4.

Fig. four
3. Click Add Parameter to add a new parameter for the new compiler.
4. Type -useLegacyAOT in the name field and no in the value field. Set a new parameter for Place before to -provisioning-profile. Click “OK” to save the new startup option. See Figure 5.
A new launch option will now be displayed on the launch screen of the Customize launch.

Fig. five
5. Click “OK” to save the “Debug / Run” configuration. Now the package will be with the new compiler.
Flash proThis feature is available in Flash Pro CC 2014 and later. When packaging for iOS, select Enable faster packaging to enable -useLegacyAOT no.

Starting AIR 15.0, packaging mode with a new compiler is the default. This means that for all AOT goals such as
ipa-app-store, ipa-test, ipa-ad-hoc and ipa-debug , a new compiler is used for packaging. You do not need to use the
–useLegacyAOT switch to use the new compiler packaging mode.
Note: If you want to use the old packaging mode, use the –useLegacyAOT switch with the value yes in the command line, or in Flash Builder when packing the IPA.
results
The new compiler significantly reduces packaging time while maintaining the same performance.
Packing timeFigure 6 and 7 illustrates how the new compiler is almost 5 - 20 times faster than the old compiler. For smaller applications, amplification is mainly due to the precompiled built-in library.

Fig. 6

Figure 7.
Runtime PerformanceYou do not have to notice significant changes in performance while running applications packed using the new compiler.
Report any performance issues to Adobe if you experience any problems while running your application.
Known Issues
New compiler functionality is available as Beta version. Although it works on most applications, you may experience some stability issues.
For more information, see
Known Issues .