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.

Comments (9)
Good point, I find it actually month ago, from Flex devnet: http://link.brightcove.com/services/player/bcpid1681730258?bctid=1844687190
Posted by: Armen at December 10, 2008 11:03 AMURL: http://abrahamyan.com
Does anybody know which mxmlc arguments are passed when Flex Builder performs a Release Build? Sounds like my Deploy ANT Task might need updating! :)
Posted by: Jonny at December 10, 2008 11:29 AMURL: http://www.jonnyreeves.co.uk/
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.
Posted by: Steve M at December 10, 2008 11:40 AMURL: http://www.artjumble.com/blog
Jonny - I believe the mxmlc arguments are "-optimize" and "-debug", though there could be more.
Posted by: Grant Skinner at December 10, 2008 11:42 AMURL: http://gskinner.com/blog/
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
Posted by: greg h at December 10, 2008 11:56 PMURL: http://blog.halcyonsolutions.net/
@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
Posted by: Chris Brind at December 11, 2008 12:30 AMURL: http://www.perplentropy.com
Great tip, i didnt know that.
Ales
Posted by: Ales at December 11, 2008 02:28 AMURL:
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.
Posted by: Russ at December 11, 2008 09:06 AMURL:
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.
Posted by: Debasish Bouri at December 16, 2008 11:23 PMURL: