Skip to content

Concurrent transform producer#23539

Open
aevyrie wants to merge 4 commits intobevyengine:mainfrom
aevyrie:concurrent-transform-producer
Open

Concurrent transform producer#23539
aevyrie wants to merge 4 commits intobevyengine:mainfrom
aevyrie:concurrent-transform-producer

Conversation

@aevyrie
Copy link
Copy Markdown
Member

@aevyrie aevyrie commented Mar 27, 2026

Objective

  • Stop living in a world where the schedule can decide to run random systems on one of the hottest paths in any bevy app.
  • Run root iteration concurrently with propagation instead of sequentially.

Solution

  • Do the thing.

Testing

  • YOLO

…opagate_parent_transforms`. This has the added benefit of no longer dealing with random systems being picked up by the par_iter.
let nodes = &nodes;
let static_optimizations = &*static_optimizations;

task_pool.scope(|s| {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this change preventing the scope from running systems?

Copy link
Copy Markdown
Member Author

@aevyrie aevyrie Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It never yields to the pool in this case. It will eagerly spawn workers and drive them to completion without ever giving it a chance to try to await system futures.

Anecdotally, using the buffered channel stuff elsewhere - which does await regularly - I haven't seen the system scheduling bug. I don't know if that's because there is always more work to do within the scope or something, but in practice it has been avoiding the systems-pulled-into-scopes stalls you see in traces.

@IceSentry IceSentry added C-Performance A change motivated by improving speed, memory usage or compile times S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Transform Translations, rotations and scales labels Mar 27, 2026
@aevyrie
Copy link
Copy Markdown
Member Author

aevyrie commented Mar 28, 2026

FYI this needs more benchmarking before considering for merge.

Edit: working through some degenerate cases found in bevy_city.

@alice-i-cecile alice-i-cecile added S-Needs-Benchmarking This set of changes needs performance benchmarking to double-check that they help and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Transform Translations, rotations and scales C-Performance A change motivated by improving speed, memory usage or compile times S-Needs-Benchmarking This set of changes needs performance benchmarking to double-check that they help

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants