Requirements
User level
All
Required products
Adobe AIR

 
Introduction

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.  
 

 
Compiled Mode Overview

When packaging an AIR application for iOS:
 
  1. The developer’s SWF file is parsed to extract the Action Script Bytecode (abc) chunks.
  2. The abc content is then analyzed and each AS function is translated to the respective native function using the LLVM API.
  3. An object file for the target platform is generated with the help of LLVM code generation.
  4. An executable file is then created by linking the object files with AIR Runtime libraries.
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.
 
Packager
Figure 1
 
 
Legacy compiler v/s New compiler
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.
 
Legacy Compiler
 
New 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.
 
Legacy Compiler
Figure 2
 
New Compiler
Figure 3
 

 
Using the New Compiled Packaging Mode

In AIR 14, you can use any of the following methods to start using the new compiler.
 
 
Command Prompt
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
 
Flash Builder
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.

 
Customize Launch Parameters
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.
 
New Launch Parameter
Figure 5
 
5. Click OK to save the Debug/Run configuration. Packaging now takes place with the new compiler.
 
 
Flash Pro
This feature is available in Flash Pro CC 2014 and later. When packaging for iOS, select Enable faster packaging to enable -useLegacyAOT no.
 
file

 

 

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.
 

 
Results

The New compiler considerably reduces packaging time for the same performance experience at run time.
 
 
Packaging 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.
 
Results 1
Figure 6
 
Results 2
Figure 7
 
 
Run-time performance
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.
 

 
Known Issues

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.