views:

42

answers:

1

Hi,

I'm writing a piece of software for the iPhone/iPod. I've tested it on the simulator and lately using my first gen. iPod touch. To my surprise the code is a bit sluggish on the iPod device.

My program (using core graphics) draws a large background image, a couple of other images, a large radial gradient fill, uses transparency (alpha), uses a couple of rounded rect clips, a circular clip, draws some individually rotated text around a circle, and rotates the whole thing. The code obviously uses a couple of nested save/restore contexts. The whole thing is dynamic and needs to calculate a lot of thing on the fly.

I have some questions for the more seasoned iPhone programmers:

(1) What kind of performance should I expect from a program like the one that I described. Does it sound as if it sould really fly or does it sound relatively complex for these kind of devices?

(2) What are the speed differences between different iPod/iPhone models?

(3) Are there any known things to avoid when working with core graphics? Any obvious optimizations (image color depths/resolution)?

thanks in advance,

-M

A: 

There are three classes of device: ARM7 (iPhone, iPod touch first gen, iPhone 3G, and iPod touch second gen), Cortex A8 (iPhone 3G S, iPod touch third generation) and A4 (iPad, iPhone 4). Devices in the same class should have similar performance.

CoreGraphics in general is slow because it doesn't use the GPU at all. Use CoreAnimation to separate your scene into layers and only redraw what is necessary for a small boost, or port your drawing code over to OpenGL ES for the best performance.

rpetrich
Hi,Thanks for your answer.It's just that core graphics seems like a nice API... I know OpenGL but I also know that I'll have other problems there like rounded edge rects/clips, drawing text, etc.Do you have any idea what's the real speed difference between the different gen. devices? Maybe I'd be ok just by forgetting about the 1st gen. devices?-M
Mika
Cortex A8-devices are roughly twice as fast as ARM7 ones; A4 is roughly 70% faster than Cortex A8. Not all operations get the same speedup though, and on the iPad and iPhone 4 the higher resolutions eat into the speed gains.P.S. You should upvote or accept answers you find helpful.
rpetrich