Skip to content

BufferPool: add size-class bucketing and eviction #25

Description

@m96-chan

Current issues with gpu/buffer-pool.ts:

  1. Linear scan (O(n)): acquire() walks the entire pool array for matching usage
  2. No best-fit: size >= aligned check means a 256-byte request can grab a 1GB buffer
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions