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

╄→尐↘猪︶ㄣ 提交于 2019-12-11 14:16:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!