Warnings mode, the dangerous friend [ by Thibault Imbert ]

Since Flash CS3, two new modes have shown up in the ActionScript Settings.

You can reach this panel from :

File -> Publish Settings -> Flash Tab -> Script > Settings.

The "Warnings Mode" will give you some hints when compiling mainly for migration, like saying that the createEmptyMovieClip method is replaced by the new instanciation model introduced in ActionScript 3.

This mode will also give you some hints like saying that the firstName variable will be converted to boolean at runtime in the following code :

var firstName:Boolean = "Bob";

When coding for the first time in ActionScript 3, this mode is very nice but it takes a lot of processing during compile time to handle all those warnings. This results in a high reduction of compilation time if you keep this mode enabled. By disabling it, I switched on my computer from 34 seconds to 10 seconds to compile a big project, which is just great.

So if you are compiling in Flash CS3 or CS4 and coding in FDT or Eclipse where you may already have a lot of warning errors being tracked when typing, especially with the fantastic as3v from the crazy Joa, you may not need this mode anyway, so just disable it to boost compilation time.

Thanks to the Flash team engineers for telling me about this trick ;)

Comments (14)

  1. Antonin wrote::

    Hé bien, voila qui va peut-être me permettre de gagner de précieuses secondes de compilation :)

    Merci pour l’astuce :)

    Friday, July 24, 2009 at 5:45 pm #
  2. Jloa wrote::

    Never used ‘strict mode’. I came across similar problem when writing as3 classes with library assets. The stage objects reference like ‘this.myButton’ throwed errors while in ‘strict’

    Friday, July 24, 2009 at 5:51 pm #
  3. Abraham wrote::

    Wooooooow!!! amazing, it really saves a lot of time, i’m working on a project that originally takes 36 secs to compile, but with the magic of this trick it only takes 8 seconds!

    Thanks!

    Friday, July 24, 2009 at 6:23 pm #
  4. Ramon Fritsch wrote::

    Hello there,

    Thank you for this tip! I ‘translate’ your post by my words in my blog.

    I did test in my mac and almost reduces 50% of my compile time in big projects O_O. Very nice practice.

    Cheers

    Friday, July 24, 2009 at 8:53 pm #
  5. Thanks for this. Very usefull!

    Saturday, July 25, 2009 at 3:49 pm #
  6. Gilles Vandenoostende wrote::

    Wow, went from 24 seconds to only 6! My timesheets thank you.

    Monday, July 27, 2009 at 9:56 am #
  7. pault107 wrote::

    That’s a really great tip – thank you!

    Thursday, August 6, 2009 at 9:19 pm #
  8. Ogla Sungutay wrote::

    I use the Adobe Flex SDK in Linux with fcsh. Compilations are in strict mode and I can compile huge projects under a few seconds.

    Friday, August 7, 2009 at 12:44 pm #
  9. Richard Haven wrote::

    How many seconds it take you to fix a bug that a warning or strict mode would have caught?

    Thursday, August 13, 2009 at 7:55 pm #
  10. I just want to confirm it works, massively! It seems the more code / API you include in your project, the slower it can become with this option switched on.

    On average for me a standard game project will take around 12-15 secs to compile, but with a large game project it takes a massive 55 secs with each new API / class adding about 2-10 secs a piece.

    With this option off (turning off strict mode can help as well) I get back my 12-15 secs compile time which is sweet because waiting a minute every time to test the smallest (or largest) of changes is pretty unacceptable for me.

    Wednesday, August 26, 2009 at 8:16 pm #
  11. Thibault Imbert wrote::

    Hi Richard,

    This optimization trick only requires to disable warning mode, not the strict mode which is really useful and definitely should stay on. The warning mode only catches migration issues and other minor code warning.

    Hi Leroy,

    Cool to hear ! :)

    best,

    Thibault

    Wednesday, August 26, 2009 at 10:14 pm #
  12. Meister wrote::

    Warning mode has saved me during logical operations, sometimes writing = instead of ==.
    The warning asks if you mean ==.

    Otherwise this can be a hard bug to track down because its outcome is completely unrelated to what the intention was.

    Friday, August 28, 2009 at 3:09 pm #
  13. Thibault Imbert wrote::

    Hi Meister,

    Yes, that’s true. There are some cases where the warning mode can be really useful. But it’s tempting to disable it, when you see the compilation time boost you can have when disabling it.

    Btw, to avoid doing this error you can also write your conditions like this :

    if ( 10 == score )

    Instead of the classical :

    if ( score == 10 )

    This way, you’ll get compiler error if you use simple equality operator like this :

    if ( 10 = score )

    best,

    Thibault

    Friday, August 28, 2009 at 3:21 pm #
  14. Andrew wrote::

    I finally stopped compiling in Flash altogether and have switched to compiling in FlashDevelop and using code injection. The first time I got a project to compile I just assumed it wasn’t working at all. Compile times reduced from 30+ seconds to about 1-2 seconds. Now I need to check out this Warnings mode setting.

    Monday, February 15, 2010 at 4:32 pm #

Trackback/Pingback (1)

  1. [...] Imbert over at http://bytearray.org beleavs that you can speed up your compile time by disabling the Warnings mode in your File -> [...]