Skip to content

Transform propagation sometimes takes a very long time (300ms+) #19411

@Ekranos

Description

@Ekranos

Bevy version

0.16.0

Relevant system information

cargo 1.89.0-nightly (47c911e9e 2025-05-14)
Windows 11

What you did

Sometimes we move a lot of objects around (floating origin) and need the transforms to be updated for later systems. If we need to move everything we call.

commands.run_system_cached(bevy::transform::systems::propagate_parent_transforms);

After some trial and error and reading the docs, we now call:

commands.run_system_cached(bevy::transform::systems::mark_dirty_trees);
commands.run_system_cached(bevy::transform::systems::propagate_parent_transforms);
commands.run_system_cached(bevy::transform::systems::sync_simple_transforms);

Sadly i was unable to find in which order these should be called.

In 0.15.0 we only scheduled propagate_transforms.

What went wrong

After upgrading to bevy 0.16.0 transform propagation sometimes takes very long (even 300+ms). In 0.15.0 the transform propagation wasn't even something we noticed in tracy.

Additional information

Screenshot of tracy displaying the time distribution, notice the stragglers at the right.
Image

These seem to coincide with the long running transform propagation. Seems odd to have so many threads taking so long.
Image

Example of a scene:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-TasksTools for parallel and async workA-TransformTranslations, rotations and scalesC-BugAn unexpected or incorrect behaviorC-PerformanceA change motivated by improving speed, memory usage or compile timesS-Needs-ReproductionNeeds an up-to-date or minimal reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions