perf(web): stop serializing the whole Main on idle native frames
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

measurement on the 238-object scene: the native gpuFrame draw path itself
takes 160-200 ms, but every frame cost ~20.8 s because the unified dispatcher
serialized the entire ~13 MB Main before and after each gpuFrame to compare
bytes for change detection. desktop Blender never does that per frame; changes
come from the undo stack and RNA notifiers.

the worker now reports whether a frame carries only non-mutating input (motion,
focus, grab-cancel) and the dispatcher skips both Main writes for those idle
frames, judging change from the native undo step and playback flag instead.
idle and hover frames drop from ~20.8 s to ~0.13-0.24 s; the large-open headed
case still passes (2.4 min). frames carrying press/key/wheel input keep the
byte comparison for now, which is tracked as the next performance item
(change detection via incremental SceneIR/undo signals instead of a full
serialization). wasm 8d398dc4137a52a419975a2587c5c1edc935d01e4132e59d874ea4078390acc0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-12-06 10:08:02 +08:00
parent 5a21a34c34
commit ac123aa72b
7 changed files with 34 additions and 16 deletions

View File

@@ -61,3 +61,4 @@
- 验收口径保持 `NOT_CLAIMED`;不以编译成功、单例通过或产物存在代替功能完成。
- 不修改既有五个 `run-*-headed.mjs` 运行器;不手工推进 `docs/EXECUTION_QUEUE.md` 的 `nextTask`。
- 每条处理完成后,在本文件对应条目补回执路径与结论;残余不得删除或改写为“已通过”。
| 14 | 大场景下可写 Main 的输入帧仍约 21 s:`gpuFrame` 前后各做一次整部 Main 序列化做变更检测 | `glowing-petting-map.md`(性能收尾) | 空闲/悬停帧已由 `idle` 提示优化到约 0.13–0.24 s;按下/按键/滚轮帧仍走双写(有头用例 2.4 分钟通过) | 改为增量变更信号(SceneIR/undo/RNA 通知),避免整部 Main 序列化;P1 |

View File

@@ -53,6 +53,8 @@
## 残余缺口(真实、未修复)
1. **大工程打开后视口输入就绪标志不恢复(已修复)**:根因链——open 期间与 open 之前发出的同步命令(`pythonExec`、`viewportObjectAxis`)排在 85 s 的 open 和先前那一帧之后,超过 30 s 默认超时,使客户端 `mainUncertain=true`;此后所有帧被拒绝为“WebEngine Main 状态待恢复”,绘制循环终止。测试侧 `exposeWebTools()` 还会切到 Web 视图使帧泵空闲,放大了“需要额外输入唤醒”的假象。按桌面“文件加载独占事件循环”的语义修复:只读同步命令超时不再判定 Main 不确定(`WebEngineClient`);应用遇到该拒绝时保持帧泵并按 250 ms 重试等待迟到响应,owner 变更帧计入第一帧就绪(`WasmGPUCanvas`);帧路径仅在 Main revision 变化或携带输入时发布场景、几何仅在 revision 变化时发布且页面保留上一份几何(`web-engine.worker.ts` + `App.tsx`)。回归用例 `COLLADA large open republishes viewport readiness without extra input` 在原生视图内打开工程,无输入断言就绪恢复,再以中键拖拽确认原生帧回执前进;有头通过(约 2.4 分钟)。open 期间仍会记录两条超时日志,但不再终止画布。`acceptance` 保持 `NOT_CLAIMED`。
性能:修复后空闲/悬停帧仍约 20.8 s。分段实测显示原生 `web_engine_gpu_ui_frame` 全程仅 160–200 ms,耗时在统一命令分发器对 `gpuFrame` 前后各做一次整部 Main 序列化(约 13 MB × 2)做变更比较。现由 worker 把“本帧仅含移动/焦点/抓取取消事件”作为 `idle` 传给原生,空帧跳过两次写入、改用原生 undo/播放标志判定;空闲帧降到约 0.13–0.24 s(`web_engine.wasm` `8d398dc4137a52a419975a2587c5c1edc935d01e4132e59d874ea4078390acc0`),有头用例复跑通过(2.4 分钟)。剩余:携带按下/按键/滚轮等可写 Main 事件的帧仍需前后双写(约 21 s/帧);下一步是把变更检测改为基于 SceneIR/undo 的增量信号,而不是整部 Main 序列化。
2. **完成度评估器**:`tools/web/evaluate-wbv2-completion.mjs` → `coverage-baseline.mjs:47` “historical references must be an array”,使 manifest 落为 `BLOCKED`,与用例执行结果无关。
3. ~~**失败导入的状态文案**:状态栏直接显示转换错误堆栈。~~ 已修复(2026-11-22):`model-convert.worker.ts` 只回传 `error.message` 不再回传 `error.stack`;`App.tsx` 的 `importColladaFile` 只取首行并去掉 `Error:` 前缀。负例 `attempt-PuR5JL` 断言状态栏含 `COLLADA 导入失败` 且不含堆栈行(PASS)。
4. **满尺寸场景的 undo/redo 超出单例窗口**:对 YT2 场景执行 `setObjectOrigin` → undo/redo 在 185 s 上限内未完成(历史恢复需重开 13 MB Main 并重建 236 网格),两次尝试均被上限终止、无回执。小场景(nested_hierarchy 导入)同一路径 PASS(`attempt-OFrAEc`)。需单独评估满尺寸历史重建的耗时与预算。