Oh Em Gee, All of Those trace() Statements
Posted: November 6th, 2009 | Author: Huyen Tue Dao | Filed under: Development | Tags: actionscript, compiling, flex, optimization, performance | 2 Comments »Alright, so I saw this insideria.com article by Tyler Larson about conditionally compiling for cleaner Actionscript when it came out and figured that it would be a good idea for peeling out some performance. And Procrastee McProcrastinator (that’s me) didn’t get a chance to try any kind of pruning yet.
Then tonight as I’m tidying up some code for my side project I see this tweet by Ben Clinkinbeard noting that adding a trace statement increased a loop’s runtime by 1 second. So following Larson’s article with a little help from flexexamples.com for setting up a flex-config.xml file, I set conditional compiling for every single trace statement and then compiled a new release build.
Wow. Just wow. We’re talking seconds shaved off loading batches of images. And I’m frequently loading these small batches of images so the additional time was just piling up.
I feel incredibly duh-I-should-have-known-that-I-am-such-a-noob.
But hey, live and learn, right? And I apologize to folks following me on Twitter for the spam and gratuitous face-palming.
Update: Dave Rosenfeld informed me via Twitter that trace actually initiates some disk I/O. No wonder.




