问题
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:
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.
来源:https://stackoverflow.com/questions/5003394/ios-core-animation-performance-issues-with-catransaction-interpolating-transf