YL

PERFORMANCE · Vite + three

渲染耗时与 info 面板Render timing and info panel

结合 stats 与 renderer.info,对比轻重场景耗时。

效果预览

轻量 WebGL 示意(非完整工程实现),可拖拽旋转;完整逻辑见下方提示词。

预期产出 · Returns

Vite:轻/重场景切换、周期性打印 memory 与 calls、可选 GPU timer 说明。

适合用在哪

优化前后录屏对比、教学演示性能。

容易踩的坑

  • 重量场景切换时未 dispose 几何与纹理会让 memory 只升不降。
  • 上千独立 Mesh 未 merge 时 calls 爆表,与教学「对比」目的相悖。
  • Safari 等环境 WebGL timer query 不可用,需在注释说明降级到 stats。

提示词 · Prompt

Vite + Three.js:集成 stats;按钮切换轻量(单 mesh)与重量(上千 mesh 或高细分);每 2 秒打印 renderer.info.memory 与 render.calls;切换时 dispose 旧对象。可注释 WebGL timer query 的局限性。参考官方示例的性能观察方式自写。
Vite stats plus light/heavy scene toggle, periodic renderer.info memory and calls log, dispose on switch, note GPU timer query limits. Chinese comments.

相关提示词

参考链接

标签