Sprite versus MovieClip

Posted: April 12th, 2013 under Optimization.

SpriteVsMCGraph

For years I have heard horror stories about the bad performance of Flash’s MovieClip class, so much so that I have aggressively replaced as many objects as I can with Sprites. Obviously MoiveClip objects use a bit more memory, but how much more processing time do they take compared to Sprites? When exactly do they become expensive? Does it matter how you have your display list organized (according to Adobe, shallower is better; however, we do not have a cost comparison)? Surprising answers and discoveries are abound!

Feel free to generate your own results:




*Note* for accurate results shut down other pages running flash content, keep the app in focus, and don’t move your mouse.

• An empty Sprite or MovieClip created with code or referenced from the library all showed the same performance, as you would expect.

• On my high end laptop I had over 36,000 empty Sprites on the Stage with still no signs of the app slowing down.

• Empty Sprites still generate mouse events.

• I tried testing performance of nested display assets, as you approach 800 nested objects the screen goes blank. I believe you are hitting a recursion limit.

• A Sprite and a one frame MovieClip containing the same art have identical load on processing.

• If you fat finger in accidental key frames or regular frames (identical art on all frames), there is only a modest performance hit, even with the MovieClip playing.

• An honest to goodness MovieClip playing (two different frames in this test) is about 7 times the performance cost of a similar, non-animating display object.

If I managed to tickle your brain about Flash performance, you might want to check out my work on benchmarking ActionScript. If you have discovered any other performance differences between Sprite and MovieClip please share in the comments!

Thanks for reading, and remember, we are all in this together.

submit to reddit
Delicious Bookmark this on Delicious

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment