-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[3.x] Add theme item cache to Control
#64329
[3.x] Add theme item cache to Control
#64329
Conversation
Is this PR complementary to #64314 or was it superseded by it? |
It's a backport to 3.x |
Control
bump, @YuriSizov @akien-mga This was missed for the 3.5.1 release. Is there anything else I can do here? |
To minimize the risk for regressions and accidental compatibility breakages, 3.5.x usually only gets bug fixes, not new features. If this PR is merged, this feature would normally only be in 3.6. That said, since this PR fixes a performance regression between 3.4 and 3.5, an exception may be made here to cherry-pick it to the |
I don't think this is really a feature, it's only intended to address a performance regression. The editor was close to unusable for us and extremely laggy with a lot of console output... so I'm surprised that no-one else is experiencing this. But also perhaps it is only us though, as I would imagine there would be more issues reported if it was widely experienced. |
This looks good, but I'd prefer if the commit had the proper co-author attribution and title like #64314. We usually do cherry-picks with
You can also add yourself as co-author if you had to do significant work to make the backport with This makes it easy to find back the original commit, and the original PR, for a cherry-picked commit. |
Just getting back to this here, and I tried to cherry-pick the suggested commit into what's current on 3.x, and at first glance it's just a bunch of more work to resolve all the conflicts in suggested manner (and then test again to make sure i didn't miss anything and have merged into the correct spots). example of the proposed cherry-pick below, (these are just totally wrong and not even close to correct and I would just end up redoing what I have already done): So is there another method to get original author and commit reference into this PR so it is acceptable without redoing this work manually? ( I do want to credit and capture that, I just don't want to redo and potentially re-break something). Most of the work here isn't necessarily in the code itself, but a lot of my time was spent identifying & isolating the issue, & then verifying, testing, and profiling the proposed backport of the cache impl. |
Sorry for the delay. You could use the commit I pushed to my branch: https://github.com/akien-mga/godot/commits/fix/control-theme-cache (rebased from what I had done back in October as example) It can be done manually like this:
Then set commit message to:
|
(cherry picked from commit 9f88300) Co-authored-by: Jordan Schidlowsky <jordanschidlowsky@gmail.com>
efd41cd
to
1647f4d
Compare
Thanks! |
Back port of #64314
Part of a few PRs to address: #64241
To quick and dirty benchmark an affected control function say
get_color
, you can add the following tool script to any Control node. This will give you a run_toggle flag in the inspector, and will print the execution time in millis to the editor console.The performance increase will be dependent on any particular project. As the complexity of theme computation in a project will differ in each project and on any particular scene tree... But the following lines are expensive due to complexity and memory allocations in the
List<>
itself and what ends up getting populated in thetheme_types
list:List<StringName> theme_types; _get_theme_type_dependencies(p_theme_type, &theme_types);
The cache in this PR avoids this hotspot, and in our project, the timing from the above gdscript tool results on average a 6x speedup improvement in most of the affected control functions:
With the cache:
Without any caching:
The above were tested in editor with
release_debug
. The actual improvements in our project are even higher (roughly 10-20x), when benchmarked outside of gdscript when called from c++ (which we can't really provide a MRP for) and on non-editor pure release builds.