🧵 Object Pooling vs. Instantiate/Destroy
A split-screen 3D comparison of naive instantiate/destroy spawning against object pooling, with a live frame-time graph showing how pooling avoids garbage-collection stalls.
A split-screen 3D scene where identical projectiles spawn on both sides at the same rate — the left half allocates and disposes a fresh mesh for every spawn, the right half recycles instances from a fixed pool, and a live graph plots the real per-frame cost of each approach.
🔬 What It Demonstrates
The naive side genuinely creates new geometry and material objects and disposes them on despawn, producing measurable, spiky per-frame update cost. The pooled side reuses a pre-built array of meshes with no runtime allocation, staying low and flat even as spawn rate climbs.
🎮 How to Use
Raise the spawn rate and GC pressure sliders to stress both scenes, then watch the frame-time graph split apart. Adjust pool capacity to see what happens when the pool runs out of idle instances.
💡 Did You Know?
Game engines like Unity and Unreal ship built-in pooling APIs precisely because frequent small allocations — not big ones — are what trigger frame-hitching garbage-collection pauses in real-time loops.
A split-screen 3D comparison of naive instantiate/destroy spawning against object pooling, with a live frame-time graph showing how pooling avoids garbage-collection stalls.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install