Dreadful Display Object Performance. What Can I Do?

According to this thread, it looks like you’ve got 64-128mb of texture memory to work with on the iPad/iPhone4 and 24mb on iPhone3GS. Spritesheets will reduce your usage, but otherwise you might have to figure out how to use fewer graphic assets…

When I have the time I’d like to run a bunch of different stress tests for texture usage et c. [import]uid: 120 topic_id: 20749 reply_id: 81997[/import]

So I’m using 133MB of Texture Memory currently? O_O How can that be when my textures only take up 12MB of disk space? [import]uid: 82003 topic_id: 20749 reply_id: 82003[/import]

Oh, huh. Does 133.070848 mean 13.30 megabytes then? This is the module I use to keep track of memory: http://developer.anscamobile.com/code/output-fps-and-texture-memory-usage-your-app
FWIW, my graphics take up about 5MB but texture memory usage hovers around 16MB in-game. Maybe someone can explain what’s going on there in more technical terms. [import]uid: 120 topic_id: 20749 reply_id: 82005[/import]

I plugged in that performance analytics code you linked to and it’s definitely telling me that I’m using 133MB of texture memory :slight_smile: I haven’t the slightest idea how it’s taking 12MB of textures and blowing that up to 133MB. Pretty impressive :slight_smile:

EDIT: Is this a Power of 2 issue maybe? I don’t think any of my textures are sized to a power of 2… [import]uid: 82003 topic_id: 20749 reply_id: 82023[/import]

Aha. This post explains why my texture memory is much, much higher than the amount of disk space my textures take up: http://developer.anscamobile.com/forum/2011/03/05/texture-memory-not-correct#comment-26856.

By using 1024x1024 texture atlases and trimming any empty space in my textures, I should be able to bring that number down significantly :slight_smile: [import]uid: 82003 topic_id: 20749 reply_id: 82042[/import]

I’m in the process of converting all of my assets over to spritesheets, but preliminary tests are showing very positive results :slight_smile: My texture memory usage has been *dramatically* reduced, and I think that was the biggest thing bringing down my game’s performance.

I still have a lot of content left to integrate, though… :slight_smile:

Thank you all for your input and support! :slight_smile: [import]uid: 82003 topic_id: 20749 reply_id: 82329[/import]

Final Update :slight_smile:

I integrated all of my remaining content and my game is still running at 60FPS :slight_smile: Using the spritesheet API, I was able to lower my texture memory usage from 133MB to 26MB on my iPhone 4 :slight_smile:

Thanks for helping me out! I’m glad this turned out to be a solvable problem :slight_smile: [import]uid: 82003 topic_id: 20749 reply_id: 82591[/import]

Hello Bdjones,

Sorry we did not see this post earlier as we would have helped you out. We cannot agree with Bryan more with his suggestions. Calling too many functions in your game loop will kill your performance. Our suggestion is to call as few functions as possible or even better call your update function every other frame or every fourth frame as chances are the user will not notice. Just be sure to readjust your fade rates. This simple trick sped up our game extensively even before we optimized the code itself (ie localizing globals, using physics engine, caching properties.)
At any case we are glad you were able to fix your issue. Could you perhaps elaborate on how profiler helped you? It will help us make the software better the more we know how it is being used.

Thank you,
M.Y. Developers [import]uid: 55057 topic_id: 20749 reply_id: 85669[/import]

The profiler definitely helped me visualize what pieces of my code were taking the longest to execute. I was able to make some tiny optimizations because of this. But the thing that was killing my performance was texture memory usage – nothing else.

It might have been helpful if the profiler offered some general performance guidelines (“Your scripts should execute within N milliseconds each frame in order to have a stable framerate” or “Try to keep your texture memory usage under this amount”).

On a tangential note, I did try using the Memory Usage Over Time mode, but I was never able to open that up in my browser (Chrome) without it freezing. Maybe that would have helped if I had been able to open the report…can’t say :-/ [import]uid: 82003 topic_id: 20749 reply_id: 86230[/import]