This morning, I decided to fork BunnyMark to find how each of the NME rendering methods compare to one another.
I was surprised by the results. I suspect that some of these tests can be improved, so feel free to send pull requests.
The benchmark was run on a MacBook Pro with OS X 10.8.
One of the things you need to bear in mind when developing for mobile devices is that the GPU is almost entirely responsible for adequate performance.
On a laptop or a desktop, CPU-based rendering can perform as well or better than GPU rendering, depending on the system. All the tests used GPU rendering on native, but software when testing Flash Player.
Based on my experience with Flash Player, I would expect it to perform 66% worse on mobile. This is not meant to be a comparison with Stage 3D, but you can see some results here.
- 35000 bunnies using drawTiles
- 10750 bunnies using drawTriangles (no alpha)
- 9250 bunnies using drawRect (no alpha, scale or rotation)
- 1750 bunnies using Bitmap
- 1750 bunnies using drawTiles (without batching)
- 700 bunnies using copyPixels (no alpha, scale or rotation)
- 11750 using copyPixels (no alpha, scale or rotation)
- 900 using Bitmap
- 900 using drawTriangles (no alpha)
- 100 using drawRect (no alpha, scale or rotation)
These are the amount of bunnies that were rendered at a consistent 60 FPS. As you can see by the notes above, some of the tests did not render the alpha, scale or rotation values of the benchmark.
Based on these tests, the drawTiles API is the clear performance winner for native. However, drawRect and drawTriangles both performed very well, though they lacked some rendering features.
Using Bitmaps did not perform as well as the Graphics methods, but it still performed faster than in Flash.
If you are targeting Flash Player, the fast software rendering method is copyPixels, unless you have a project that does not need a lot of instances on-screen. This also sacrifices features for performance. Bitmap still may be a faster method if you need alpha, scale or rotation.