360 Secure SkillHub
360 安全技能中心

threejs-performance

该 Skill 提供 Three.js 性能与内存排查流程:区分加载/编译停顿与稳态帧成本,定位 CPU、绘制调用、GPU 填充或内存瓶颈,给出实例化、降低过度绘制、减少分配与资源释放建议,并要求用前后测量验证优化效果。

cesartevisual
热度 0.00
最近更新 2026-10-19 06:48:01
分类:开发依赖:纯提示词应用场景:调试排错 / 报告撰写 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add cesartevisual/threejs-skills/threejs-performance
Metadata
name
threejs-performance
description
Profile and optimize Three.js frame time, GPU workload, asset memory, and resource leaks.

Performance and Memory

Use the project's installed versions and existing architecture. These instructions supplement the user's task; they do not authorize unrelated changes or external actions.

Reproduce on a representative device and record scene state, viewport, pixel ratio, backend, asset sizes, and frame-time distribution. Distinguish first-load/decode/compile stalls from steady-state frame cost. Read the profiling worksheet for a repeatable before/after record.

Determine whether the bottleneck is CPU work, submission/draw calls, GPU shading/fill, transfers, or memory. Reduce resolution to probe pixel cost; isolate shadows/effects; compare static versus animated updates. Change one major variable at a time.

Use instancing/batching when draw calls dominate, reduce overdraw/effect resolution when fill dominates, and simplify animation or move appropriate work off-thread when CPU-bound. Lowering triangles will not fix every bottleneck. Avoid per-frame allocations and repeated shader recompilation.

Define resource ownership across shared caches and instances. Release owned geometries, materials, textures, targets, controls, mixers, observers, and listeners. Disposing a material does not dispose its textures; disposing a renderer does not free all scene-owned objects. Do not dispose cache entries still in use.

Measure repeated mount/unmount and model replacement after warmup. Internal caches can leave nonzero counters; look for an unexplained rising trend rather than demanding zero. CPU heap and renderer.info are partial evidence, not exact GPU memory.

Accept an optimization only when the measured improvement preserves required appearance and interaction. Report device, method, before/after values, and limits of the measurements.

API reference

Consult the official documentation for exact signatures and revision-specific behavior. If documentation access is unavailable, inspect installed types/source and state any remaining uncertainty.