We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.8.3
all
无论 node.active 是否为 true , node.invalidateChildren() 总是会被执行, 导致性能出现问题.
node.acitve 或者 _activeInHierarchy = false 时, 对node 进行一些处理时, 还是会 调用 invalidateChildren , 而 invalidateChildren 是深度全遍历的. 我的实际场景中, 有 20000 (2万) 多个节点, 但是其中大多是 是 active 或者 _activeInHierarchy = false的. 然后 对他们的 父节点 进行某些操作时, invalidateChildren 还是会对 那些隐藏的节点进行处理. 从而影响性能
No response
如上所述.
The text was updated successfully, but these errors were encountered:
在 _onPostActivated() (active为true) 和 _onSetParent() (parent不为null) 中的 invalidateChildren() 可以考虑强制执行, 其他的情况 是否可以不执行invalidateChildren() ?
另外 invalidateChildren() 会往 dirtyNodes 里添加很多节点. 然后 updateWorldTransform() 方法又会对 dirtyNodes 中的节点进行较复杂的计算 , 计算时同样不会判断节点是否是 active 的 , 这里应该也会引起性能问题吧 ?
还没有对 3.x 做深入研究, 以上两条观点只是猜测. 但是用chrome做性能检测 , 在我的场景里, invalidateChildren() 确实是性能热点之一 .
Sorry, something went wrong.
我测试了下, 在 updateWorldTransform() 前面 加上
if (!this._active || !this._activeInHierarchy) { return; }
似乎没什么问题, 不过只针对我的项目, 不知道是否有通用性.
另外我打印了 updateWorldTransform 里的 dirtyNodes 的状态, 其中大量的 active=false的节点. 这些节点在active=false时, 应该无需计算矩阵吧?
如果 invalidateChildren 和 updateWorldTransform 方法不能改动的话, 希望能把 dirtyNodes 变量暴路出来 . 这样我可以自己重写 invalidateChildren 和 updateWorldTransform , 目前 因为 dirtyNodes 等变量的作用域限制 , 我无法自己重写这两个方法.
目前看下来, 问题的关键点是 _active / _activeInHierarchy = false 的节点也被放入 dirtyNodes , 导致性能问题
_active / _activeInHierarchy = false 的节点也被放入 dirtyNodes , 导致性能问题
No branches or pull requests
Cocos Creator version
3.8.3
System information
all
Issue description
无论 node.active 是否为 true , node.invalidateChildren() 总是会被执行, 导致性能出现问题.
node.acitve 或者 _activeInHierarchy = false 时,
对node 进行一些处理时, 还是会 调用 invalidateChildren , 而 invalidateChildren 是深度全遍历的.
我的实际场景中, 有 20000 (2万) 多个节点, 但是其中大多是 是 active 或者 _activeInHierarchy = false的.
然后 对他们的 父节点 进行某些操作时, invalidateChildren 还是会对 那些隐藏的节点进行处理. 从而影响性能
Relevant error log output
No response
Steps to reproduce
如上所述.
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: