Apparat (TAAS) framework to optimize swf

Joa Ebert is a Flash developer with a focus on ActionScript 3. He has developed several tools helping to optimize daily workflow. Most projects have been released as open-source. The most important one is Apparat / TAAS project:

Apparat is an open source framework written in Java to optimize ABC, SWC and SWF files. The core of Apparat are its three file formats and their implementation:

  • ABC (read and write ABC files, bytecode analysis and tools)
  • SWC (read and write SWC files)
  • SWF (read and write SWF files, tag implementations)

TAAS is a stackless representation of the ActionScriptBytecode. Read first results of TAAS, and see application before and after optimization.

The TAAS compiler is different from the ActionScript compiler since its input is not ActionScript source code but already compiled SWF or SWC files. Just like the haXe compiler can output AS3 instead of a SWF the TAAS compiler can do the same. Now if you add one and one together you see that the TAAS compiler can be used as a very strong decompiler. My own tests have shown that it will work flawlessly where other commercial decompilers output rubbish. Since the compiler behaves like the Flash Player it will “execute” the bytecode in order to parse it which means it has a very highlevel understanding of the structure inside the SWF. (Joa Ebert)

4 comments so far

  1. stephan December 15, 2011 13:35

    Hi there

    I recently stumbled upon this post
    http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/ActionScript/A_2107-20-Tips-to-Optimize-your-ActionScript.html
    which explains how to optimize as3 code via very simple rules.

    Aparat offers bytecode optimization. But I can´t find any information about what that really means.

    I am working on a quite big project right now and currently I am searching for further possible tweaks to it.

    So are these tips even relevant if I let Aparat do it´s bytecode magic anyway?

    Thanks in advance

    Stephan

  2. Jozef Chúťka December 15, 2011 14:15

    Hi Stephan,
    for deeper info you should visit developers website http://blog.joa-ebert.com . e.g. http://blog.joa-ebert.com/2010/10/02/how-jitb-converts-actionscript-to-java/

  3. stephan December 22, 2011 18:55

    hi jozef

    thanks you for your quick reply.
    the thing is: none the the links really provides me with the info if these changes would be made by apparat automatically.
    so, does apparat for example exchange
    x = x * 64;
    with
    x = x << 1; (i´d say probably yes??)
    and if yes can apparat take it even further and
    excange
    var parts:Array = longString.split("|");
    with
    var parts:Array = longString.match(/(.*?)\|/gm); (i´d say probably no??)
    so where exactly is the line of what apparats byte-optimization can and can´t do?

    cheers

    stephan

  4. Jozef Chúťka December 23, 2011 12:18

    hi stephan,
    I do not have personal experience with that, please try it yourself or ask Joa

Leave a comment

Please be polite and on topic. Your e-mail will never be published.