Current issues with gpu/buffer-pool.ts:
- Linear scan (O(n)):
acquire() walks the entire pool array for matching usage
- No best-fit:
size >= aligned check means a 256-byte request can grab a 1GB buffer
- No eviction: Pool only grows, never shrinks — no cleanup of unused buffers
Proposed improvements
- Size-class bucketing (power-of-2) for O(1) acquire
- Best-fit or smallest-fit selection to prevent GPU memory waste
- High-watermark based eviction to reclaim unused buffers
Current issues with
gpu/buffer-pool.ts:acquire()walks the entire pool array for matching usagesize >= alignedcheck means a 256-byte request can grab a 1GB bufferProposed improvements