Skip to content
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 bulk change guards to successive theme overrides in Editor and GUI #83626

Conversation

YuriSizov
Copy link
Contributor

I noticed that in TabContainer we're overriding every theme property of its internal TabBar, which triggers a theme update for every property update. We have guards just for the occasion, so I checked all GUI code, both in editor and in scene, and added those guards.

I only touched cases where there are at least three sequential add_theme_*_override calls on the same control. While two sequential updates are also not great, I decided not to bother to avoid making code more verbose than it needs to be. I don't think performance improvements from that would be massive. As an exception, I did update twos in places where I was already making other changes.

Another exception is calls before a control is added to the tree. If it's not in the tree, it doesn't matter, so those I ignored regardless of the number of calls. In some cases I modified code to follow this pattern (add overrides before adding as a child), and had to update nearby code for consistency as well.


This should make theme updates a bit snappier, especially in the editor. But I don't think it would be drastic on a decently powerful system. I didn't notice much difference for startup times, but maybe changing the editor theme is a bit better now. Ultimately, it affects individual controls rather than propagates throughout the tree, so it shouldn't be too impactful.

@YuriSizov YuriSizov force-pushed the control-less-is-more-as-in-less-excessive-notifications-is-more-performance branch from d86fac5 to 215e036 Compare October 19, 2023 16:14
@akien-mga akien-mga merged commit 68a183a into godotengine:master Oct 20, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@YuriSizov YuriSizov deleted the control-less-is-more-as-in-less-excessive-notifications-is-more-performance branch October 20, 2023 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants