Posts

Showing posts from November, 2012

20 Tips To Optimize Your Actionscript

This article was written several years ago for Experts Exchange, and has proven to be a little more controversial than I expected or intended, mostly due to the (admittedly vague) reference to what I call AS3′s “fake” lazy evaluation, which happened to be (rather randomly) listed as the first tip. I’m removing that tip from the list, not only because it’s likely confusing, or that the performance gains realized by following it would be minimal at best, but also because it might be a safe assumption that future version of the player might correct it. First, a quick word about the issue itself.

AS3 (and many languages) use “lazy” evaluation. That’s to say that a boolean expression will stop evaluating as soon as it can. Take the following expression:

1if( a > b || c > d)
That means that the second condition (c > d) won’t ever be examined at all, if a is greater than b. This is usually not terribly noticeable, since it’s not obvious if the second component was e…