Is packaging Flascc-generated swf files slow with AIR iOS?

Flascc (earlier called Alchemy) is a tool to convert your native code into a swf file. If you try to package such a swf file into an iOS application (.ipa) using ADT, then the packaging time depends a lot on the optimizations that you used with Flascc. For instance, using “-O4” could increase the packaging time by more than 4 times against using “-O2”.

Let me show that using the 01_HelloWorld sample bundled with the Flascc SDK. The sample is a just single line hello world C code.

 #include
 int main(int argc, char **argv)
 {
     printf("Hello World\n");
 }
 


I first converted hello.c to hello.swf and then used ADT to create an .ipa with that swf.


// Compile .c to .swf

"$(FLASCC)/usr/bin/gcc" -O2  $(BASE_CFLAGS) hello.c -emit-swf -swf-size=200x200 -o hello.swf

// Package for AIR on iOS

$(ADT) -package -target ipa-app-store -storetype pkcs12 -storepass xxxxxx -keystore yyyyyy.p12
             -provisioning-profile zzzzzz.mobileprovision hello.ipa app.xml hello.swf

Following are the results with different optimisation levels used with Flascc –

Flascc Optimization Generated .swf size AOT compilation time .ipa size
-O0 (default) 369K 5 min 4.6 MB
-O2 369K 5 min 4.9 MB
-O4 294K 23 min 4.7 MB

So using –O4 really deteriorates the packaging time.

Why does this happen?

Higher optimization flags in Flassc result in generation of larger method bodies (in the swf file). And LLVM 2.9, which ADT uses internally for packaging, is known to work badly with excessively large functions.

So, here is what we recommend –

1. Use lower optimization levels in Flascc (at least during your development phase)

2. Avoid using large function in your C code, which you provide as input to the Flascc compiler.

Advertisements

One comment


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s