Create a `Scratch<T>` system param for the "reused `Local`" pattern
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
Wow this makes quite the positive improvement in that benchmark! Nice!
As an aside, I would love a new system param which is like `Scratch` which is a local that automatically clears when the system runs. It feels so good to reuse those allocations, and this is exactly the motivation!
_Originally posted by @andriyDev in https://github.com/bevyengine/bevy/pull/23758#pullrequestreview-4093981466_
@JMS55 says:
> Would love this - I've been wanting something like this for a long time! Can't remember if I have an open issue for it.
> It should ideally also keep track of occupancy, and shrink when it's over-allocated for several frames.
> Iirc I have something like this implemented in the meshlet code, but manually, instead of a system param.
Contributor guide
Research direction
Start by locating the existing `Local` system parameter and the manually managed implementation in the meshlet code. Read how system parameters are defined and how those allocations are reused. Done should include a `Scratch`-like parameter that clears on each system run, tracks occupancy, and can shrink after repeated over-allocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100