Skip to content

Reduce LayoutCache::get and BindGroupLayoutCache::get heap allocation#24503

Open
beicause wants to merge 2 commits into
bevyengine:mainfrom
beicause:layout-bgl-cache-get-optimize-allocation
Open

Reduce LayoutCache::get and BindGroupLayoutCache::get heap allocation#24503
beicause wants to merge 2 commits into
bevyengine:mainfrom
beicause:layout-bgl-cache-get-optimize-allocation

Conversation

@beicause
Copy link
Copy Markdown
Member

Objective

Reduce LayoutCache::get and BindGroupLayoutCache::get heap allocation
Part of this adopts #21757

Solution

Reduce LayoutCache::get allaction by using SmallVec with 8 elements inlined on the stack.
Avoid cloning BindGroupLayoutDescriptor in BindGroupLayoutCache::get (adopts #21757).

#21757 also avoids cloning BindGroupLayout, but I don't think it's unnecessary because BindGroupLayout is cheap to clone (it just clones id + Arc).

Testing

CI

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times labels May 31, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering May 31, 2026
@alice-i-cecile alice-i-cecile added X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 31, 2026
@olukowski olukowski added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

5 participants