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

implement par_iter_many and par_iter_many_unique #17815

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Victoronz
Copy link
Contributor

@Victoronz Victoronz commented Feb 12, 2025

Objective

Continuation of #16547.

We do not yet have parallel versions of par_iter_many and par_iter_many_unique. It is currently very painful to try and use parallel iteration over entity lists. Even if a list is not long, each operation might still be very expensive, and worth parallelizing.
Plus, it has been requested several times!

Solution

Once again, we implement what we lack!

These parallel iterators collect their input entity list into a Vec/UniqueEntityVec, then chunk that over the available threads, inspired by the original par_iter.

Since no order guarantee is given to the caller, we could sort the input list according to EntityLocation, but that would likely only be worth it for very large entity lists.

There is some duplication which could likely be improved, but I'd like to leave that for a follow-up.

@Victoronz Victoronz added A-ECS Entities, components, systems, and events D-Complex Quite challenging from either a design or technical perspective. Ask for help! D-Unsafe Touches with unsafe code in some way S-Needs-Review Needs reviewer attention (from anyone!) to move forward C-Feature A new feature, making something new possible labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible D-Complex Quite challenging from either a design or technical perspective. Ask for help! D-Unsafe Touches with unsafe code in some way S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant