29 April 2014
AIR applications for iOS can be packaged either by using the Fast packaging (interpreted mode) or the Standard (compiled mode) options. The interpreted mode, which is primarily employed for debugging, is faster than the compiled mode. Though most development and testing can be performed using the interpreted mode, run-time performance is achieved only in the compiled mode. Developers publishing applications to the Application Store use the compiled mode for better performance. The increased time required for packaging in the compiled mode, however, is often undesirable.
AIR introduces a re-designed compiled packaging mode, which aims to considerably reduce packaging time, for the same performance experience at run time. The beta version of the re-designed compiler is currently available to all developers.
Note: From AIR SDK version 16.0 onwards, the legacy compiler will not be supported and only the new compiler will be supported. As a result,
-useLegacyAOT switch will not be honored anymore.
When packaging an AIR application for iOS:
The iOS platform does not support loading executable code, dynamically. This limitation, however, allows the AIR packager to employ optimization techniques that increase run-time performance. This optimization is possible because the entire code is available at compile time. See Figure 1 for an illustration of the AIR application packaging in the compiled mode.
The new compiler is built on top of the Action Script virtual machine. Following is a comparison of the re-designed compiler and the legacy compiler.
Developed using Java, and interacted with LLVM using JNI thus affecting performance adversely.
Developed using C++ and shares most of its code with the virtual machine.
Generates a function call for each abc opcode.
Converts the opcodes into SSA based IR (intermediate representation) and generates the optimized IR.
Compiles built-in library every time an application is packaged.
|Performs incremental compilation which means that the built-in library is compiled only once and is shipped with the AIR SDK.|
See Figures 2 and 3 for an illustration of the changes in the re-designed compiler.
In AIR 14, you can use any of the following methods to start using the new compiler.
To start using the new compiler for packaging your IPA, use the –useLegacyAOT argument 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
To 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 arguments passed to ADT along with their respective values. See Figure 4.
3. Click Add Parameter to add a new argument for the new compiler.
4. Type -useLegacyAOT in the name field and no in the value field. Place the new argument before the -provisioning-profile argument. Click OK to save the new launch parameter. See Figure 5.
The new launch parameter is now displayed in the Customize launch window.
5. Click OK to save the Debug/Run configuration. Packaging now takes place with the new compiler.
This feature is available in Flash Pro CC 2014 and later. When packaging for iOS, select Enable faster packaging to enable
Beginning AIR 15.0, the new compiler packaging mode is the default packaging mode. This means that for all the AOT targets like ipa-app-store, ipa-test, ipa-ad-hoc, and ipa-debug, the new compiler is used for packaging. You need not use the
–useLegacyAOT switch to use the new compiled packaging mode.
Note: If you want to use the legacy compiled packaging mode, use the
–useLegacyAOT switch with value yes at the command prompt, or in Flash Builder while packaging IPA.
The New compiler considerably reduces packaging time for the same performance experience at run time.
Figure 6 and 7 illustrate how the new compiler is nearly 5 - 20 times faster than the old compiler. For smaller applications the gain is mainly due to the pre-compiled built-in library.
You should not experience any major change in the run-time performance for applications packaged with the new compiler.
Please report any issues you experience with run-time performance, to Adobe.
The New compiler functionality is available as a Beta version. Though it works for most applications, you may experience some issues with stability. For more information, see Known Issues.