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

Expose more of the Vec API on BufferVec #3531

Closed
james7132 opened this issue Jan 2, 2022 · 2 comments · Fixed by #8575
Closed

Expose more of the Vec API on BufferVec #3531

james7132 opened this issue Jan 2, 2022 · 2 comments · Fixed by #8575
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@james7132
Copy link
Member

james7132 commented Jan 2, 2022

What problem does this solve or what need does it fill?

More efficient mutation APIs for BufferVec than just push, reserve, and clear. Repeatedly pushing large quantities can be quite inefficient due to needing to repeatedly do size and capacity checks on the underlying Vec.

What solution would you like?

Expose more of the mutation APIs to more efficiently build BufferVecs. Most notably append for grouping chains of Vecs together.

What alternative(s) have you considered?

  • Repeatedly pushing the items onto the BufferVec.
  • DerefMut on the underlying Vec.

Additional context

This would both simplify and speed up the "prepare" stage of rendering of entities with large quantities of mutable values, including but not limited to particle systems and large scale batching.

@james7132 james7132 added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 2, 2022
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy and removed S-Needs-Triage This issue needs to be labelled labels Jan 2, 2022
@Jdogstar
Copy link

Out of curiosity, besides append, what other API's would you consider effective to add?

@james7132
Copy link
Member Author

#6833 requires adding Vec::truncate to the API, Vec::append/Vec::extend are also other options worth considering as well.

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-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
3 participants