Always Export a Release Build

When preparing a Flex project for deployment, always make sure to export a release build. I think most people know about this feature of FlexBuilder, but I’m not sure everyone is aware of just how important it is. The SWF that is generated when you run or debug your project contains a lot of extra byte code used for debugging and profiling your content.

This extra byte code has a very obvious effect on the size of your SWF (adding over 35% in some cases). It also has a less immediately obvious (but no less significant) effect on the performance of your application. In one example here at gskinner.com, a 980kb SWF was reduced to 675kb, and some performance intensive code ran over 2.5x faster in the release build than in the debug version.

Never deploy a project without exporting a release build, and be sure to test a release build if you are experiencing problems with file size, performance, or memory utilization.

Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

11 Comments

  1. Does anybody know which mxmlc arguments are passed when Flex Builder performs a Release Build? Sounds like my Deploy ANT Task might need updating! 🙂

  2. I add debug=false and optimize=true to the compiler options which seems to do the same thing. This also has the advantage of not needing to remember to export a release build as I already am.

  3. Jonny – I believe the mxmlc arguments are “-optimize” and “-debug”, though there could be more.

  4. Hi Grant,

    And one important step further in getting published SWF sizes down is using the Framework caching too!

    One fellow’s positive experience here:

    http://tech.groups.yahoo.com/group/flexcoders/message/108149

    The how to in the docs here:

    http://livedocs.adobe.com/flex/3/html/rsl_09.html

    Also a Flexcoders thread on this topic here (follow threads at the bottom of this page):

    http://www.mail-archive.com/flexcoders@yahoogroups.com/msg103723.html

    Happy Flexing!

    g

  5. @greg h – just be careful when combining rsls with module loading. there’s a pretty fundamental defect still outstanding: http://bugs.adobe.com/jira/browse/SDK-14669

  6. Great tip, i didnt know that.

    Ales

  7. Yeah Adobe should have made more buzz about this when introducing FlexBuilder 3. I took me a hile to figure out why my swfs were some much bigger coming out of FB 3 than out of 2. My question is way have the run button if it does the same thing as debug.

  8. Apart from this all, use ‘Runtime shared library (RSL)’ for a exported project.

    project -> properties -> Flex build path -> Library Path -> Framework linkage.

    The main .swf file size will reduced dramatically and hence load faster.

  9. Is there any way to set the compilers command line options based on Relese or Debug builds from within Flash Builder 4? Or from a config file? This would be useful for conditional compile info.

  10. Also remember, that compiling in debug mode will put Your source code to swf file…

Leave a Reply

Your email address will not be published. Required fields are marked *