The thing is that I can’t get more than 1,000 bunnies at the same time.
Obviously I’m doing something wrong, but I have no idea what.
I have a tile sheet with two images, the background grass and the bunny.
Two sprites, one for the world and one for the GUI.
And two text fields, that are child of the gui sprite.
I create the tile rects for each image, set the stage quality to low, format texts, blah blah, and added one enter frame event.
In the enter frame I get the delta time using Lib.getTimer(). Then maybe create some bunnies, and move them.
Finally I add all grass data than then bunny data into an Array, clear the world.graphics and in one call draw all tiles of bunnies and grass. And update the text to show current fps and amount of bunnies.
Hard to tell without seeing all the code, but you might have an issue with GC thrashing. Only way to know for sure is to profile the app, but recreating an array with thousands of elements per frame (listoftiles and Bunnies.draw()) could be the issue. Look at how the tilelayer lib handles the drawList.
Here is all the code, is pretty short actually. http://imageshack.com/a/img673/2342/u3OWIs.jpg
Mmm. Now that I think about it, it’s probably not the best order, main is in the centrer.
Main is not full, but the other things are initializations and boring configurations.
For what I can see, the rendering is killing it, takes half the time.
Garbage collector is high, but only not that high.
Anyway, I will create a DrawList class to reduce garbage collection and the time of bunnies.Draw (specially that concat) and come back to tell how it was.
You can also openfl create BunnyMark to duplicate a BunnyMark sample, comment things in the main class to change the type of test, the drawTiles test should perform the best on native targets
I just try it. The batched version of drawTiles was indeed the fastest with 22,000 bunnies.
I took out the pirate, the alpha, the scale and the moving background.
For flash target the fastest was copyPixels with 2,500 bunnies.