-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Optimize transform propagation for dynamic scenes #22281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alice-i-cecile
merged 12 commits into
bevyengine:main
from
aevyrie:configurable-dirty-tree
Dec 30, 2025
Merged
Optimize transform propagation for dynamic scenes #22281
alice-i-cecile
merged 12 commits into
bevyengine:main
from
aevyrie:configurable-dirty-tree
Dec 30, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…lpful constructors for unconditionally enabling and disabling.
…rs to constructors, disable in stress tests where appropriate.
Merged
cart
approved these changes
Dec 29, 2025
Member
cart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially very large performance wins at the cost of checking every transform's change state an additional time each frame (when enabled). Compelling numbers. Straightforward impl. Sign me up!
alice-i-cecile
approved these changes
Dec 29, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 30, 2025
# Objective - Add a stress test that exercises the 3d mesh pipeline for dynamic scenes. - Large static scenes like caldera hotel don't expose performance issues when many meshes are moving. - Give us a way to benchmark PRs like - #22297 - #22281 - #22226 ## Solution - Make a 3d version of `bevymark`, sticking to the existing patterns as closely as possible. ## Testing <img width="1072" height="684" alt="image" src="https://github.com/user-attachments/assets/41214ba9-ffad-471d-a320-1f007490dead" /> --------- Co-authored-by: Carter Anderson <mcanders1@gmail.com>
mockersf
pushed a commit
that referenced
this pull request
Dec 30, 2025
# Objective - Follow up from previous transform optimization (#18589), make the `mark_dirty_trees` system more intelligent - don't run this expensive static scene optimization for dynamic scenes. - Using a threshold was mentioned as a follow up in that PR, and we also want this threshold to be user-configurable. - This was not implemented previously because the optimizations were still large improvements even in dynamic scenes thanks to the improved parallelism #17840 ## Solution - Don't run static scene optimization (dirty tree tracking) for very dynamic scenes - defined here as scenes where more than 30% of objects have their `Transform` updated. - This is configurable with a percentage threshold, or it can be unconditionally enabled or disabled when setting to `0.0` or `1.0` to avoid the cost of computing the threshold. - For dynamic scenes, this makes transform prop much faster, twice as fast in the stress tests shown here. ## Testing transform_hierarchy stress tests, all of these cases spawn about a quarter million entities: - humanoids_active - dynamic scene that should be faster than `main`: <img width="609" height="395" alt="image" src="https://github.com/user-attachments/assets/bf3d6b93-aa09-4440-b8ac-18af7e46a00f" /> - humanoids_inactive - static scene that should be unchanged from `main`: <img width="631" height="377" alt="image" src="https://github.com/user-attachments/assets/a0306109-600b-4cdd-a217-5cc15e269bca" /> - humanoids_mixed - half dynamic scene that should be faster than `main` <img width="604" height="372" alt="image" src="https://github.com/user-attachments/assets/2751ece2-d4b9-4daa-af24-fe379eaf75b2" /> - large_tree - dynamic scene (50% of entities are moved) we expect to see improvements <img width="665" height="371" alt="image" src="https://github.com/user-attachments/assets/c6b08abe-eb1d-44fb-be36-457f9d5ba78e" />
mockersf
pushed a commit
that referenced
this pull request
Dec 30, 2025
# Objective - Follow up from previous transform optimization (#18589), make the `mark_dirty_trees` system more intelligent - don't run this expensive static scene optimization for dynamic scenes. - Using a threshold was mentioned as a follow up in that PR, and we also want this threshold to be user-configurable. - This was not implemented previously because the optimizations were still large improvements even in dynamic scenes thanks to the improved parallelism #17840 ## Solution - Don't run static scene optimization (dirty tree tracking) for very dynamic scenes - defined here as scenes where more than 30% of objects have their `Transform` updated. - This is configurable with a percentage threshold, or it can be unconditionally enabled or disabled when setting to `0.0` or `1.0` to avoid the cost of computing the threshold. - For dynamic scenes, this makes transform prop much faster, twice as fast in the stress tests shown here. ## Testing transform_hierarchy stress tests, all of these cases spawn about a quarter million entities: - humanoids_active - dynamic scene that should be faster than `main`: <img width="609" height="395" alt="image" src="https://github.com/user-attachments/assets/bf3d6b93-aa09-4440-b8ac-18af7e46a00f" /> - humanoids_inactive - static scene that should be unchanged from `main`: <img width="631" height="377" alt="image" src="https://github.com/user-attachments/assets/a0306109-600b-4cdd-a217-5cc15e269bca" /> - humanoids_mixed - half dynamic scene that should be faster than `main` <img width="604" height="372" alt="image" src="https://github.com/user-attachments/assets/2751ece2-d4b9-4daa-af24-fe379eaf75b2" /> - large_tree - dynamic scene (50% of entities are moved) we expect to see improvements <img width="665" height="371" alt="image" src="https://github.com/user-attachments/assets/c6b08abe-eb1d-44fb-be36-457f9d5ba78e" />
mockersf
pushed a commit
that referenced
this pull request
Dec 30, 2025
# Objective - Follow up from previous transform optimization (#18589), make the `mark_dirty_trees` system more intelligent - don't run this expensive static scene optimization for dynamic scenes. - Using a threshold was mentioned as a follow up in that PR, and we also want this threshold to be user-configurable. - This was not implemented previously because the optimizations were still large improvements even in dynamic scenes thanks to the improved parallelism #17840 ## Solution - Don't run static scene optimization (dirty tree tracking) for very dynamic scenes - defined here as scenes where more than 30% of objects have their `Transform` updated. - This is configurable with a percentage threshold, or it can be unconditionally enabled or disabled when setting to `0.0` or `1.0` to avoid the cost of computing the threshold. - For dynamic scenes, this makes transform prop much faster, twice as fast in the stress tests shown here. ## Testing transform_hierarchy stress tests, all of these cases spawn about a quarter million entities: - humanoids_active - dynamic scene that should be faster than `main`: <img width="609" height="395" alt="image" src="https://github.com/user-attachments/assets/bf3d6b93-aa09-4440-b8ac-18af7e46a00f" /> - humanoids_inactive - static scene that should be unchanged from `main`: <img width="631" height="377" alt="image" src="https://github.com/user-attachments/assets/a0306109-600b-4cdd-a217-5cc15e269bca" /> - humanoids_mixed - half dynamic scene that should be faster than `main` <img width="604" height="372" alt="image" src="https://github.com/user-attachments/assets/2751ece2-d4b9-4daa-af24-fe379eaf75b2" /> - large_tree - dynamic scene (50% of entities are moved) we expect to see improvements <img width="665" height="371" alt="image" src="https://github.com/user-attachments/assets/c6b08abe-eb1d-44fb-be36-457f9d5ba78e" />
mockersf
pushed a commit
that referenced
this pull request
Dec 30, 2025
# Objective - Follow up from previous transform optimization (#18589), make the `mark_dirty_trees` system more intelligent - don't run this expensive static scene optimization for dynamic scenes. - Using a threshold was mentioned as a follow up in that PR, and we also want this threshold to be user-configurable. - This was not implemented previously because the optimizations were still large improvements even in dynamic scenes thanks to the improved parallelism #17840 ## Solution - Don't run static scene optimization (dirty tree tracking) for very dynamic scenes - defined here as scenes where more than 30% of objects have their `Transform` updated. - This is configurable with a percentage threshold, or it can be unconditionally enabled or disabled when setting to `0.0` or `1.0` to avoid the cost of computing the threshold. - For dynamic scenes, this makes transform prop much faster, twice as fast in the stress tests shown here. ## Testing transform_hierarchy stress tests, all of these cases spawn about a quarter million entities: - humanoids_active - dynamic scene that should be faster than `main`: <img width="609" height="395" alt="image" src="https://github.com/user-attachments/assets/bf3d6b93-aa09-4440-b8ac-18af7e46a00f" /> - humanoids_inactive - static scene that should be unchanged from `main`: <img width="631" height="377" alt="image" src="https://github.com/user-attachments/assets/a0306109-600b-4cdd-a217-5cc15e269bca" /> - humanoids_mixed - half dynamic scene that should be faster than `main` <img width="604" height="372" alt="image" src="https://github.com/user-attachments/assets/2751ece2-d4b9-4daa-af24-fe379eaf75b2" /> - large_tree - dynamic scene (50% of entities are moved) we expect to see improvements <img width="665" height="371" alt="image" src="https://github.com/user-attachments/assets/c6b08abe-eb1d-44fb-be36-457f9d5ba78e" />
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
D-Straightforward
Simple bug fixes and API improvements, docs, test and examples
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
X-Uncontroversial
This work is generally agreed upon
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
mark_dirty_treessystem more intelligent - don't run this expensive static scene optimization for dynamic scenes.Solution
Transformupdated.0.0or1.0to avoid the cost of computing the threshold.Testing
transform_hierarchy stress tests, all of these cases spawn about a quarter million entities:
main:main:main