Jonnie Hallman from DestroyTwitter fame and recently employed by the Adobe XD team, wrote a great article about how he reduced CPU usage in his AIR application.
“AIR gets a bad rap for being a bloated runtime, using up a lot of precious memory and CPU. Although a lot of AIR applications seem to fall into this trap, it doesn’t have to be this way. There are a number of techniques you can use to develop a lightweight application that rivals native programs in terms of performance,” he says.
The article explains what framerate throttling is and how best to implement it in your application.








I managed to create an AIR app that sends and loads lots of external data and images and still remain CPU friendly. So yes, it is possible. But what frustrates me is that we get such a powerfull tool (flash/actionscript) but we must use it soooo carefuly and use all sorts off workarounds when developing an AIR app to keep the CPU usage at a low level. I don’t think that sort of stuff should be the developers problem but should rather be fixed (or improved) by Adobe. Flash developers have always pushed Flash to the extreme. With AIR, developers are held back again.
Yup, great article. Apps like TweetDeck are in a constant lag (well, slightly better lately though), so it totally makes sense to all of us.
@Youri
I don’t agree that an AIR application (or Flash website, banner, or RIA) requires workarounds and hacks to achieve a decent level of memory or CPU usage.
If developers don’t clean up after themselves, and use techniques such as object pooling (http://www.lostinactionscript.com/blog/index.php/2008/10/30/object-pooling-in-as3/) then you’re setting yourself up to fail.
@Dan Love: I already use object pooling (in AIR apps), and i clean things up. I would just like so see Adobe make things a bit easier for developers. I would like to be able to say “remove this movieclip and EVERYTHING in it”. Now I have to manually clean up listeners and timers, stop running loaders, remove bitmapdata, delete variables, …
And if you have MC’s nested in other MC’s again nested in MC’s all running their own script, then it can be a real pain in the ass if you want to remove the parent clip and clean up everything in it. Especially if you don’t know what’s in it at the time it needs to be removed.
And yes, I have my own way of solving all these problems, but I still believe Adobe can do better on this (instead of investing more time in Flex :-) )
Thanks for the plug, Serge!
Sweet…. This is what I’m looking for
Hello all,
I am relatively new to Adobe AIR and I’ve made a small application that only plays some video files on screen. The application doesn’t have any border or chrome at all. A simple movie player.
I have used both the VideoDisplay & Video class with NetStream object to play the files but both take almost 100% of my CPU resources. I am running it on windows XP with 2.4GHz processor and 1 GB RAM. I tried both AIR 1.5 & 2.0 but of no use.
I tried lowering the framerate to 10 and yet it only brought the usage to 90 or 85% mark, obviously very high value for a simple video player. Is there any way that I can use to reduce this CPU usage in my application.
Thanks