bevyengine / bevyengine/bevy

Expose information about system-internal parallelism to the scheduler

Open
#19,740 0 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Feature C-Performance S-Needs-Design-Doc X-Needs-SME
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

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

Whether or not a system uses parallelism, such as via `Query::par_iter`, is extremely important information for optimizing performance.

Multiple heavily parallel systems should not be run beside each other at the same time.

## Possible solutions

1. Manually mark a system as parallel via system config, as a type of performance hint for schedulers.
2. Require a special `ParQuery` system param to access `Query::par_iter`
3. Have a virtual unit type resource `ParallelAccess`, and require the user pass in `&mut ParallelAccess` into `Query::par_iter` to get it to compile.

I think that 3 is simply a better form of 2. We may want scheduler performance hints in some form anyways though, even if we don't end up using it for parallelism.

## Additional context

Prompted by @ItsDoot: https://discord.com/channels/691052431525675048/749335865876021248/1385332129269022790

Contributor guide

Open the contributing guide

Research direction

Start by examining the scheduler and the existing Query::par_iter path. Compare the proposed system config, ParQuery, and ParallelAccess approaches, including how each would expose parallelism to scheduling. Done means agreeing on a design and defining how schedulers can avoid running heavily parallel systems together.

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
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.