iOS 核心动画:CATransaction / 插值变换矩阵的性能问题

发布于 2024-10-17 14:33:37 字数 499 浏览 2 评论 0原文

我正在测试我的 iPhone 应用程序的性能:

// 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];

问题:为什么禁用核心动画在新旧变换矩阵之间进行插值的默认行为会带来如此大的性能提升?

他们可能在做什么,计算成本如此之高?即使他们使用世界上最复杂的技术在两个矩阵之间进行插值,我也不敢相信这会达到 5fps?!

我无法想象这个过程除了 M_resultant = k*M_last + (1.-k)*M_target 之外还有什么

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不…忘初心 2024-10-24 14:33:37

在两个位置之间进行插值会创建 CAAnimations,该动画必须按帧应用并在渲染线程和主线程之间同步。

交易成本与您一次动画的层数有关;尝试分析您的应用程序以查看瓶颈是什么。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文