Comments (3)
在 _onPostActivated() (active为true) 和 _onSetParent() (parent不为null) 中的 invalidateChildren() 可以考虑强制执行, 其他的情况 是否可以不执行invalidateChildren() ?
另外 invalidateChildren() 会往 dirtyNodes 里添加很多节点.
然后 updateWorldTransform() 方法又会对 dirtyNodes 中的节点进行较复杂的计算 , 计算时同样不会判断节点是否是 active 的 , 这里应该也会引起性能问题吧 ?
还没有对 3.x 做深入研究, 以上两条观点只是猜测.
但是用chrome做性能检测 , 在我的场景里, invalidateChildren() 确实是性能热点之一 .
from cocos-engine.
我测试了下, 在 updateWorldTransform() 前面 加上
if (!this._active || !this._activeInHierarchy) {
return;
}
似乎没什么问题, 不过只针对我的项目, 不知道是否有通用性.
另外我打印了 updateWorldTransform 里的 dirtyNodes 的状态, 其中大量的 active=false的节点. 这些节点在active=false时, 应该无需计算矩阵吧?
from cocos-engine.
如果 invalidateChildren 和 updateWorldTransform 方法不能改动的话, 希望能把 dirtyNodes 变量暴路出来 .
这样我可以自己重写 invalidateChildren 和 updateWorldTransform , 目前 因为 dirtyNodes 等变量的作用域限制 , 我无法自己重写这两个方法.
目前看下来, 问题的关键点是 _active / _activeInHierarchy = false 的节点也被放入 dirtyNodes , 导致性能问题
from cocos-engine.
Related Issues (20)
- preview the project then it occurs error "fc1977d5-d6f8-4f99-bf65-b9f1f60393b7.json" 404 (Not Found)
- autoAtlas pack costs a lot of time
- Unable to attach file image in android webview HOT 1
- 希望官方能把官方出品的几个cocos的vscode插件上传到 https://open-vsx.org/ 上.
- When install NPM package fflate, build the project it occur errors
- When install NPM package fflate, import it in the project it occur errors
- logic differences in gfx-vulkan/VKCommandBuffer.cpp
- Some unused variables, please have a check
- vivo 小游戏不能使用TTF字体
- Set the Custom pipeline, the shadow color change from light dark to green HOT 1
- compress texture has any optimization of its speed
- 微信小程序缓存目录优化 HOT 1
- 在安卓设备上反复进出导致崩溃 HOT 1
- AudioSource组件 web player播放器 调用play方法播放 注册的回调没有清除
- 2D Particle crash on native platforms
- Crash if launching game multiple times on Android platform with PhysX module enabled.
- 编辑器EditBox bug
- node.setWorldScale(0, 0, 0) causes NaN issue in scale and worldMatrix properties
- Cannot attach component to node if project created in folder with symbolic link (junction)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocos-engine.