Posts in Category "Performance"

AOT Compilation Optimization

This post will talk about a small optimization that developers can do within their code to reduce the amount of time taken for AOT compilation of their application I would recommend developers to read this post to understand what is meant by AOT compilation.

One of the intermediate steps in AOT compilation requires LLVM to process the LLVM bytecode and to optimized LLVM bytecode. In case one of your function has a lot of actionscript code (~30000 lines) then the corresponding LLVM code is around 1.3 million lines. LLVM is known to perform badly (compilation time) on large functions. As a recommendation, actionscript developers should break down on large function into smaller functions to reduce the AOT compilation time. They need not change any code, just break a large function into many smaller functions to reduce AOT compilation time significantly.

Embedding assets in your mobile application

Traditionally flash developers have been more focused on the browser to deliver their content. While delivering the content through the browser, developers generally embedded their assets within the root swf. Honestly, there is no other way except loading these images off their servers but this could have resulted in a lag whilst the content was running

With AIR however, developers need to make certain changes to their applications to make them more apt for deployment on mobile devices. With AIR, developers get access to the file system and the assets for their content can be accessed off the file system instead of being embedded within the root swf. Assets for the application should be packaged along with the application and then should be accessed on demand by simply loading them using a Loader.

Continue reading…

AOT or Interpreter

Traditionally, computer programs can be executed in three possible ways – interpreted, static (ahead-of-time) compilation and Just In time (JIT). In interpreted mode, the code is translated from high-level language to low level language during execution whereas in ahead-of-time compilation the high-level language code is converted to low-level machine code before hand. JIT (Just in time) compilation is a hybrid approach of the two. Here the code translation into native code occurs during the execution time and the translated code is cached so that this conversion need not be done every time. Obviously there is a small penalty when compared to ahead-of-time compilation as there is a cost associated with this translation.

After this brief introduction lets get into the Adobe AIR world and what is there in it for an iOS AIR developer. SWF content on all platforms other than iOS is JIT compiled, whenever possible. The swf is downloaded locally and JIT compiled where possible. Continue reading…

Anti Aliasing and Cache As Bitmap on iOS

In this post, I will explain a little about how Cache As Bitmap can impact Anti Aliasing of your content.

Let’s start with a definition. To put it very simply, I will say that anti aliasing is what gives smooth look to your content. Anti Aliasing is a way to make content look smoother by drawing certain pixels to avoid jaggedness.

For iOS applications, there are two render modes – cpu and gpu. Let us look at what all can happen with this seemingly harmless change. For all further purpose please assume that we have set the render mode as gpu within application descriptor.

Before I start, look at the two ellipses in the diagram. If you stare hard enough you will agree with me that the left image loses out when compared to the one on right in terms of quality. The right one looks like a smoother version of the left one. If you had difficulty defining anti aliasing then this image should help clear the definition. The right one is anti aliased better or is smoother.

Continue reading…

Stage3D FAQs

In this blog entry I will gradually pen any interesting observations that I come across with stage3D which will help actionscript developers gauge a better insight as to what happens behind the scenes.

For the folks who are unaware of stage3d, Stage3D is a new model of rendering developed by Adobe which provides a set of low level GPU accelerated APIs advanced 2D and 3D capabilities across multiple screens and devices (desktop, mobile, and TV) through the runtimes. These APIs provide advanced 2D and 3D developers with the flexibility to leverage GPU hardware acceleration. Please visit for more details.

1) Calls synchronous or asynchronous

One question that would perplex stage3d code writers would be as to how do calls stack up. This may assist them in understanding why certain calls take longer than other. Almost all calls in Stage3D are asynchronous. Anything in stage3d is passed as a request to the gpu which gpu then takes up on its leisure and processes them as it feels like. Following are the exceptions and are calls that are synchronous in nature Continue reading…