-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Simplified UI tree navigation without ghost_nodes
#17143
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
Simplified UI tree navigation without ghost_nodes
#17143
Conversation
Yeah I noticed this but didn't comment earlier. Here's my take: right now ghost nodes are in this kind of quantum superposition state where we haven't committed to keeping them or not. There are three possible outcomes as I see it:
The only world in which this PR is really helpful is one in which ghost nodes continue to be supported as an optional feature, and honestly I hope that won't be the case, that we make up our minds one way or another. I'm taking a "wait and see" attitude for now. That being said, the instant that cart's new relations spawning API drops, I'll be providing an update to thorium_ui which uses the new API and which offers a new and better developer experience, and this will be using ghost nodes. I've been deliberately holding off on promoting any of my ideas until this happens. |
Yep, I agree with that analysis. I definitely like this as a "merge for now" solution. I suspect we can optimize ghost node performance quite a bit in the future, one way or another, assuming we decide to keep them around. This PR makes sure we have a good target for that work :) |
I'm not adding any complex optimisations here, I'm just replacing the ghost nodes system param stuff with regular queries for the I mostly agree otherwise ghost nodes are needed and shouldn't be optional. The current implementation is really bad though, it doesn't need to be this expensive or allocate and the feature-gate is broken. It there is a 0.15.2 release maybe this could be included, users shouldn't be paying the cost for a disabled ghost nodes feature. |
Btw the ghost-enabled iterator can be optimized by using the design of |
# Objective There is a large performance regression in the UI systems in 0.15 because the `UiChildren` and `UiRootRootNodes` system params (even with `ghost_nodes` disabled) are really inefficient compared to regular queries and can trigger a heap allocation with large numbers of children. ## Solution Replace the `UiChildren` and `UiRootRootNodes` system params with simplified versions when the `ghost_nodes` feature is disabled. ## Testing yellow this PR, red main cargo run --example many_buttons --features "trace_tracy" --release `ui_stack_system` <img width="494" alt="stack" src="https://github.com/user-attachments/assets/4a09485f-0ded-4e54-bd47-ffbce869051a" /> `ui_layout_system` <img width="467" alt="unghosted" src="https://github.com/user-attachments/assets/9d906b20-66b6-4257-9eef-578de1827628" /> `update_clipping_system` <img width="454" alt="clipping" src="https://github.com/user-attachments/assets/320b50e8-1a1d-423a-95a0-42799ae72fc5" />
Objective
There is a large performance regression in the UI systems in 0.15 because the
UiChildren
andUiRootRootNodes
system params (even withghost_nodes
disabled) are really inefficient compared to regular queries and can trigger a heap allocation with large numbers of children.Solution
Replace the
UiChildren
andUiRootRootNodes
system params with simplified versions when theghost_nodes
feature is disabled.Testing
yellow this PR, red main
cargo run --example many_buttons --features "trace_tracy" --release
ui_stack_system
ui_layout_system
update_clipping_system