← 🧮 Algorithms & AI
⚠ NAIVE — new / destroy
✓ OBJECT POOL — reuse

🧵 Pooling Lab

Naive active: 0
Naive update:
Pool active: 0
Pool update:
Allocations (naive): 0
FPS:
Update time per frame (ms) naive   pooled
Drag — rotate both scenes · Scroll — zoom

🧵 Object Pooling vs. Instantiate/Destroy

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.