Parallel System Execution Disabled (Sequential Fallback) #693
Labels
No labels
Context: Async
Context: Bug
Context: CI
Context: Dependencies
Context: Documentation
Context: Enhancement
Context: Example
Context: Macro
Context: Runtime
Difficulty: Easy
Difficulty: Hard
Difficulty: Medium
Platform: Android
Platform: iOS
Platform: Linux
Platform: macOS
Platform: Web
Platform: Windows
Type: Discussion
Type: Evaluation
Type: Tracker
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
SakulFlee/Orbital#693
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context: The ECS SnapshotExecutor previously used rayon::scope to run non-conflicting systems in parallel. This was changed to sequential execution when Commands support was added, because rayon threads can't safely share a single &mut Commands buffer.
Current behavior: All systems run sequentially within a batch, even when they access different components. The greedy batch scheduler correctly separates conflicting systems, but within a batch, they run one-at-a-time.
Desired behavior: Non-conflicting systems within a batch should run in parallel using rayon.
Root cause: The System::run() signature changed to include &mut Commands. Multiple threads writing to the same Commands buffer causes data races.
Proposed solution: Give each system its own per-thread Commands buffer during parallel execution, then merge all buffers after the batch completes:
This requires
Commands::append()to work correctly (it does — uses Vec::append which clears the source).Performance impact: With the current low system count (2-5 per frame), the sequential fallback is negligible. When system count grows to 10+, this should be re-parallelized.
File: Crates/ecs/src/system/executor.rs:22-23