Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render: consider reusing geometry buffers with best matching allocated size #1258

Open
niello opened this issue Mar 15, 2022 · 0 comments
Open
Labels
optimization Speed, memory or binary size optimization tasks

Comments

@niello
Copy link
Contributor

niello commented Mar 15, 2022

This would improve resource reuse, especially for GPU buffers. To do this, the following is required:

  1. Make an allocated size an attribute of the base GeometryBuffer
  2. In the Renderer, store pool sorted by allocated size ascending
  3. When requesting the new buffer
    a. If the pool is empty, create new buffer
    b. If allocated size of pool.back() is less than requested, return the pool from the back with O(1) and let the user code reallocate it
    c. Else find the best buffer in the pool with lower_bound, maybe with an interpolation search, i.e. hinted version, because we can predict distribution of buffers in a pool by size quite precisely and start searching from the most probable point.
@niello niello added the optimization Speed, memory or binary size optimization tasks label Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Speed, memory or binary size optimization tasks
Projects
None yet
Development

No branches or pull requests

1 participant