views:

805

answers:

3
+1  A: 

I don't think it's a memory issue; I'm thinking that it has to do with the inefficiency of having that large of an image in terms of Core Animation.

Core Animation can't use it natively, as it exceeds the maximum texture size on the GPU (1024x1024). I would break it up some; individual images might give you the best performance, but you'll have to test to find out.

IIRC, UIImageView does its animating by setting successive individual images, so if it's good enough for Apple….

Andrew Pouliot
After some refactoring, I broke the image up so now there are 10 images, each with the 24 frames and then those images are split into two rows to make the dimensions 576 x 96. And it's certainly a lot faster than before. There is still some jerkiness when starting to animate though.I'm still suspecting that Core Animation is discarding the decompressed PNG after it's copied out the section that it wants to display. I can't see any other reason why it would animate smoothly when it gets going, but have a delay after the display is static for some time.
U62
A: 

Have you tried using CATiledLayer yet?

It is optimized for this type of work.

Corey Floyd
AFAIK CATiledLayer is for the opposite case - that of creating one really large layer (> 1024x1024) from lots of separately drawn tiles.
U62
Hmmm. I think I misunderstood what you are trying to accomplish, could you provide some more info (I commented some questions to your original question)
Corey Floyd
+1  A: 

When it is about performance, I definitly recommend using Shark (also over Instruments). In the 'Time Profile' you can see what are the bottlenecks in your app, even if it is something in Apple's code. I used it a lot while developing my iPhone app that uses OpenGL and Core Animation.

Nikolai Ruhe
I played about with instruments a bit, not tried shark yet. The problem I have is that I'm only concerned with what happens immediately after my view gets a TouchesBegin event because the application isn't doing anything outside of the TouchesBegin/TouchesMoved/TouchesEnd sequence and all that idle time makes averages a bit meaningless. Is there any way you can enable/disable collection in your code?
U62
That's exactly why Shark is better suited for this task than Instruments: Instruments does not distinguish between idle and active CPU but Shark does.This means, you can profile for 10 seconds, manually activating your code (by tapping a button or whatever) a couple of times. The profile Shark produces only shows the samples where the CPU was actually doing something. If you further narrow down the code paths by selecting your main thread only you can easily see what's going on in your code.
Nikolai Ruhe
About programmatically enabling Shark: There has been the CHUD.framework in MacOS 10.4 but it has been made private in 10.5. It never existed for iPhone OS as far as I know. There's a way of controlling a remote profiling session using signals (see man shark), but I don't know if that's working on the iPhone.
Nikolai Ruhe