Mar 122012

“Andy, Andy,” a man shouts excitedly. “I love your blog post on improving mobile performance with AS3!”

Andy has heard this phrase dozens of times now, having just attended a GDC full of flash and mobile development friends. “Thank you, fine sir. I hope it worked out well for you.”

“Well…” He stammers for a few seconds, and tugs on his collar in an absent-minded fashion. “I’m not seeing the performance increase of astounding amounts. It might be a little faster… I just can’t figure it out. It’s a simple game, and it gets quite low FPS!”

Andy has heard this complaint before, and is immediately skeptical, but maintains his composure. He asks the standard battery of questions – did they do the bitmap caching properly, do they have a proper static variable in the wrapper class, but they never seem to lead to a solution. Everything seems fine. That is, until Andy asks the fateful question: “Are you displaying the Bitmaps wrapped in a Sprite, as I suggested in the article?”

“Oh, I don’t need to,” he responds. “I’m using flixel.”

It really is a sight to see; watching somebody calmly grab the edge of a table, and in one quick motion flipping it over. The world seems to enter bullet-time; the salt shaker spinning through the air, the table completing two full rotations before first touching down on the ground. As Andy rises from his chair – face bright red in anger, veins bulging from his incredibly muscular neck – he looks to the sky. With arms outstretched, a primal roar escapes his lips.

Andy then sits back down, corrects his table, and instructs this fellow developer to read the whole article, particularly the bit at the end that says that blitting (and by extension, all blitting engines, such as Flixel and Flashpunk) circumvent the performance enhancements. Andy then recovers the salt shaker, and calmly explains how the start of the article also¬†mentions the use of flash’s standard display list.

The man finally realizes his folly. Flash does not* have access to the powerful GPU on desktop computers, and blitting is a way to more efficiently use the CPU to render things. On mobile devices, flash DOES have access to the GPU, and automatically does a blitting-equivalent of the display list. Telling flash to use blitting manually (by using Flixel/Flashpunk) is telling it to NOT use the GPU, but the CPU instead, hobbling perfromance. He then gives Andy a million dollars.

*stage3d not counted

  8 Responses to “FanFic: DisplayList vs. Blitting”

Comments (8)
  1. FYI, I do see the typo “perfRomance” but decided to keep it. I think it should be a new word.

    Also: Stage3D, starling, and Air 3.2 will probably work around ALL of these problems. Can’t wait for official launch :)

  2. Well, the tricky thing here is that people don’t use flixel/fp for performance (after all, modern desktops are pretty fast and using the displaylist is probably still fast enough on them despite not using the gpu) but because it’s a lot easier to use than the plain flash api.

  3. I’m not saying DON’T use it; I’ve cannabalized parts of flixel/flashpunk for my own private libraries of useful tools. Just don’t use the display engine part of it, IF you want the best mobile performance.

  4. LOLZ

  5. You and your table flipping shenanigans, they never get old. I’ll be doing something for mobile very soon, so I’ll come back to your blog and read the original article. I’m using FlashPunk, so I might need to change some things up in order to use the display list, but it shouldn’t be too much of a change.

  6. Awesome writeup.

    Also, this is now the format I will expect everything you blog about to be written in.

  7. BTW, not entirely related but if you want flixel *and* good mobile performance, check out HaxeFlixel: it uses nme’s drawTiles function in the native target for fast rendering on mobiles, and copyPixel on the flash target for fast rendering on desktops.

    The best of both worlds!

  8. lmao. This article is so funny. I just started getting comfortable with as3 blitting explosions and sparkles in as3. My tard native-loving colleagues said blitting wouldn’t work on mobile, but I’ll take a look at your other article and hopefully prove them wrong :)

Sorry, the comment form is closed at this time.