When Flash introduced the copyPixel operation a few versions ago, I was very excited. Finally, I could create blazing fast games that worked more like “real” games instead of using MovieClips. However, copyPixel is no magic bullet.
Here are the results of a simple test where I scroll a background image. I guessed that copyPixel would yield the fastest results, but I was wrong.
Note that during initial testing it was difficult to get a big difference with an 800×600 drawing area.
Of course, that’s because I’m only moving 1 image around as opposed to hundreds as in an actual game.
Thus, to make the differences stand way out, I increased the drawing area to 1880×1024.
This will fill up Fire Fox if your resolution is 1920×1200, but you can still see the drawing area.
The frame rate is set to 120.
Note also that I am using a crazy big image of size 4095×4095 (3.5 Megs).
Various OSs and Browsers
|#||Method||Mode||Fps Fire Fox - Win||Fps Internet Explorer - Win||Fps Fire Fox - Mac|
|4||Copy Pixel||gpu||27-28 (wtf?)||43-45||21-22|
|8||Sprite||gpu||120 solid (wow)||61-63||33|
|12||MovieClip||gpu||120 solid (wow)||58-62||33|
So, the really confusing thing for me is that copy pixel seems to drag down gpu mode!
Also, remember when “opaque” used to be the best wmode option for performance? Not any more (at least for this specific test).