Ariaware Optimizer Explained (Simply!)

I just responded to a thread on Ultrashock wherein one of our members was confused as to how Ariaware Optimizer works so I thought a simple explanation with an example might make it clearer. Here goes:

Flash compiles your AS classes into bytecode (instructions that the Flash player can read and understand) and places this bytecode inside your SWF file.

When you can multiple SWF files in your application that use the same classes, the bytecode for these classes is included in every SWF file.

So, for example, you have three classes, A, B and C and three SWF files SWF 1, SWF 2 and SWF 3. The compiled sizes of classes A, B and C are given below (this is the size of the bytecode that is generated)

A: 20kb B: 15kb

C: 35kb

SWF 1 uses class A and B SWF 2 uses class A, B and C

and SWF 3 uses class A and C

Now think about the size of your application. Assuming for a second that these are the only classes used by the SWFs:

Size of SWF A = 20kb + 15kb = 35kb Size of SWF B = 20kb + 15kb + 35kb = 70kb

Size of SWF C = 20kb + 35kb = 55kb

Total size of application before Optimizer = 35kb + 70kb + 55kb = 160kb.

Now, what Optimizer does is it goes into each SWF, takes out the bytecode for the classes and makes a SWF out of each class. It then makes sure that each class is included *only once* for each application.

So, the total size of our fictitious application after Optimizer would be equal to the sum of the sizes of the classes or:

20kb + 15kb + 35kb = 70kb.

So, in this fictitious example, Optimizer would reduce the size of your application from 160kb to 70kb.

That, in a nutshell, is how Optimizer works!