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

1

0

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

Fantastically answered 15/2, 2011 at 12:3 Comment(1)
It’s not just a linear blend of the two matrices. Consider what Core Animation does if you animate between the identity transform and a 180° rotation—you get a rotation without a change in scale, whereas a linear blend would leave you with the zero matrix halfway through.Forkey
S
0

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.

Squaw answered 11/5, 2011 at 4:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.