-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add stack index to Node
#9853
Add stack index to Node
#9853
Conversation
Extraction reads the `stack_index` from `Node` instead of walking `UiStack` `ui_stack_system` updates `Node`'s `stack_index` after generating a new `UiStack`.
I'm on board with this, but could you label which graph is from which scenario? It's hard to follow. |
Yep I ran the benchmarks with the wrong settings for this initially as well. These ones should be a lot clearer. |
@ickshonpe can you resolve comments? I'll merge this ASAP after. |
Sorry, I think my other PR caused merge conflicts for this. |
Should be ready now |
# Objective If we add the stack index to `Node` then we don't need to walk the `UiStack` repeatedly during extraction. ## Solution Add a field `stack_index` to `Node`. Update it in `ui_stack_system`. Iterate queries directly in the UI's extraction systems. ### Benchmarks ``` cargo run --profile stress-test --features trace_tracy --example many_buttons -- --no-text --no-borders ``` frames (yellow this PR, red main): <img width="447" alt="frames-per-second" src="https://github.com/bevyengine/bevy/assets/27962798/385c0ccf-c257-42a2-b736-117542d56eff"> `ui_stack_system`: <img width="585" alt="ui-stack-system" src="https://github.com/bevyengine/bevy/assets/27962798/2916cc44-2887-4c3b-a144-13250d84f7d5"> extract schedule: <img width="469" alt="extract-schedule" src="https://github.com/bevyengine/bevy/assets/27962798/858d4ab4-d99f-48e8-b153-1c92f51e0743"> --- ## Changelog * Added the field `stack_index` to `Node`. * `ui_stack_system` updates `Node::stack_index` after a new `UiStack` is generated. * The UI's extraction functions iterate a query directly rather than walking the `UiStack` and doing lookups.
# Objective If we add the stack index to `Node` then we don't need to walk the `UiStack` repeatedly during extraction. ## Solution Add a field `stack_index` to `Node`. Update it in `ui_stack_system`. Iterate queries directly in the UI's extraction systems. ### Benchmarks ``` cargo run --profile stress-test --features trace_tracy --example many_buttons -- --no-text --no-borders ``` frames (yellow this PR, red main): <img width="447" alt="frames-per-second" src="https://github.com/bevyengine/bevy/assets/27962798/385c0ccf-c257-42a2-b736-117542d56eff"> `ui_stack_system`: <img width="585" alt="ui-stack-system" src="https://github.com/bevyengine/bevy/assets/27962798/2916cc44-2887-4c3b-a144-13250d84f7d5"> extract schedule: <img width="469" alt="extract-schedule" src="https://github.com/bevyengine/bevy/assets/27962798/858d4ab4-d99f-48e8-b153-1c92f51e0743"> --- ## Changelog * Added the field `stack_index` to `Node`. * `ui_stack_system` updates `Node::stack_index` after a new `UiStack` is generated. * The UI's extraction functions iterate a query directly rather than walking the `UiStack` and doing lookups.
Objective
If we add the stack index to
Node
then we don't need to walk theUiStack
repeatedly during extraction.Solution
Add a field
stack_index
toNode
.Update it in
ui_stack_system
.Iterate queries directly in the UI's extraction systems.
Benchmarks
frames (yellow this PR, red main):
ui_stack_system
:extract schedule:

Changelog
stack_index
toNode
.ui_stack_system
updatesNode::stack_index
after a newUiStack
is generated.UiStack
and doing lookups.