|
-
Senior Member
Well, I did build my own speed experiments 
I used 5000 sprites and measured time spent to do 200 enterframe steps at movie fps set to 40. Spritesize was 32 pixels and stage size was 480x360 pixels. All tests ran using standalone FP 9.0.45.0 WinXP.
Test1.
Created the bitmap objects, added them all to the stage at random positions. Each bitmap had separate bitmapdata object (small one, size of single sprite). All bitmaps had cacheAsBitmap set to false and transparent set to true.
First ran the loop without changing the position or content of objects: ~5,3 seconds.
Then ran same loop and at each step changed the position of objects randomly: 20~21 seconds.
Some additional tests with many sprites:
*changing transparent to false in every sprite reduced overall time to ~19 seconds, transparent bitmaps are slightly slower.
*changing cacheAsBitmap to true in every sprite increased overall time to ~24 seconds (not sure why)
Test2.
Created 5000 simple objects and assigned random values for xpos and ypos variables. Created 1 stagesized bitmap and added it into stage. This bitmap is cleared using fillRect at each step.
First ran the loop without changing variables in the objects: ~5,1 seconds. Slightly faster then looping through bitmaps, but by very small margin.
Then ran the the loop and changed random variables in each object, used copyPixels to copy sprite image from main sheet into stage bitmap at position of each object: ~25 seconds.
Test2 was slower overall. If you want to move around images which do not change itself (only the position), use many bitmaps.
Test3.
This was same as test2, but at each step the content of each object was also changed randomly. Not surprisingly, time was exactly same.
Test4.
Tested many bitmaps which all change the position AND the content at each step. All bitmaps had cacheAsBitmap set to false and transparent set to true. Each step changed the position of objects randomly and used copyPixels to update the content with random image: 36~37 seconds.
Test5.
Tested many bitmaps changing content using scrollRect object. Each bitmapdata object same as main spritesheet and scrollRect was used to pick image to show. Test unfinished, ran out of memory. Estimated time to finish: ~couple days.
If you have objects that change the content a lot beside moving around, use single large bitmap and copyPixels method.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|