bevyengine / bevyengine/bevy

Selective command application parallelization

Open
#4,918 2 comments 2 reactions 0 assignees View on GitHub
A-ECS C-Feature C-Performance 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?
Command application currently requires exclusive `World` access for application, which forces all commands to be executed serially in a single threaded manner. This may be too heavy of a restriction, and imposes a hefty performance penalty for Command heavy games, particularly for the current rendering implementation.

## What solution would you like?
Use much more granular locks to allow each `CommandQueue` to be applied in parallel. For example, a add/remove component command only requires access to the entity's location and source/target archetypes/tables in the common case, and occasionally needs to create a new archetype/table. Operations like batch spawning or relational commands will likely still need exclusive access, though could tentatively and carefully be made parallel.

## What alternative(s) have you considered?
Speeding up Command application so that this isn't a primary performance blocker.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by tracing how CommandQueue application obtains exclusive World access, then map which commands require entity, archetype, table, or exclusive access. Done means independent queues can apply safely in parallel while batch spawning, relational commands, and archetype creation retain any necessary exclusivity.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev, performance
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.