profile-game-performance
Installation
SKILL.md
Profile Game Performance
Systematically diagnose CPU simulation bottlenecks, GPU rendering stalls, garbage collection frame spikes, and VRAM leaks to certify strict frame-time budgets ($16.6\text{ms}$ for $60\text{FPS}$, $8.3\text{ms}$ for $120\text{FPS}$).
Core Rules
- Measure Before Optimizing: Capture baseline P50, P95, and P99 frame times, draw call counts, physics step duration, and RAM/VRAM allocations before altering code or assets.
- Zero Per-Frame Heap Allocations: Eliminate temporary object allocations, string concatenations, LINQ/array closures, and unpooled instantiations inside
_process,_physics_process, orUpdateloops to keep GC pauses at $0\text{ms}$. - Draw Call & Overdraw Ceilings: Consolidate materials, enable GPU instancing / static batching, and enforce hierarchical Level of Detail (LOD) and frustum/occlusion culling to respect platform draw call budgets.
- Contract Adherence: Emit
contracts/schemas/implementation-result.json(andcontracts/schemas/performance-audit.jsonwhen certifying performance gates).
Suggested Process
1. Frame Time Breakdown (CPU vs. GPU Bound)
Isolate the primary bottleneck using engine profilers, RenderDoc, or Tracy:
- CPU Game/Physics Bound: High script update time, excessive broadphase collision pairs, or unthrottled AI pathfinding ticks.
- CPU Render-Thread Bound: Excessive draw calls ($> 250$ mobile, $> 2000$ desktop) or frequent material/shader state switches.
- GPU Bound: High fragment overdraw from stacked transparent particles, unoptimized post-processing passes, or excessive shadow-caster cascades.