iOS Core-Animation: Performance issues with CATransaction / Interpolating transform matrices

1.1k views Asked by At

I am performance testing my iPhone app:

// using CATransaction like this goes from 14fps to 19fps
[CATransaction begin];
[CATransaction setDisableActions: YES];

// NEG, as coord system is flipped/messed up
self.transform = CGAffineTransformMakeRotation(-thetaWheel);

[CATransaction commit];

Question: why does disabling core animation's default behavior of interpolating between the old and the new transform matrix give such a performance boost?

What could they possibly be doing that could be so computationally expensive? Even if they are using the most elaborate technique in the world for interpolating between two matrices, I can't believe this would amount to 5fps?!

I can't imagine the process is anything other than M_resultant = k*M_last + (1.-k)*M_target

1

There are 1 answers

0
Andrew Pouliot On

Interpolating between the two positions creates CAAnimations which must be applied per-frame and synchronized between the render thread and main thread.

The transaction cost would be relative to how many layers your'e animating at once; try profiling your app to see what the bottlenecks are.