Status: Accepted Date: 2026-03-07 Context: Per-frame allocations in GraphManager and BotsVisualization cause GC pressure
All code in useFrame callbacks and render paths MUST be zero-allocation:
- No
new Vector3(),new Color(), etc. in render paths - preallocate in refs - No
.slice(),.map(),.filter()on arrays in frame loops - No
Date.now()in render - usestate.clock.elapsedTimefrom useFrame GlassEdges.updatePointsaccepts(buffer, length)not sliced arrays- Instanced meshes use preallocated capacity with overflow detection
useMemofor side effects replaced withuseEffect+ cleanup
// WRONG: allocates every frame
const points = edges.slice(0, count);
// RIGHT: view over preallocated buffer
edgesRef.current.updateFromBuffer(buffer, count);- GraphManager edge generation refactored to buffer-view pattern
- BotsVisualization particle positions preallocated in refs
- Measurable frame time improvement on 1000+ node graphs