[性能优化] 希望将 `batcher-2d.ts`文件中的 `walk` 方法改为非递归.
Author: finscnCreated Jun 2, 2024Updated Sep 9, 2026
LabelsFeature RequestNeeds Triage
Use Case
目前 batcher-2d.ts 的 walk 方法已经成为我们项目的性能热点之一 (游戏比较特殊, 同屏元素多 且层级深)
看了下 walk 的实现, 它并不是尾递归, 难以被js引擎自动优化, 希望能 人工优化为 非递归.
https://github.com/cocos/cocos-engine/blob/v3.8.5/cocos/2d/renderer/batcher-2d.ts#L825
Problem Description
(如上所述)
Proposed Solution
No response
How it works
No response
Alternatives Considered
无
Additional Information
No response
Source: cocos/cocos-engine