Add GLOBAL_GET cached macros.
GLOBAL_GET is an expensive operation which should not be used each frame / tick. This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed. Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
This commit is contained in:
@ -5960,7 +5960,7 @@ TreeItem *Tree::get_item_with_metadata(const Variant &p_find, int p_column) cons
|
||||
void Tree::_do_incr_search(const String &p_add) {
|
||||
uint64_t time = OS::get_singleton()->get_ticks_usec() / 1000; // Convert to msec.
|
||||
uint64_t diff = time - last_keypress;
|
||||
if (diff > uint64_t(GLOBAL_GET("gui/timers/incremental_search_max_interval_msec"))) {
|
||||
if (diff > uint64_t(GLOBAL_GET_CACHED(uint64_t, "gui/timers/incremental_search_max_interval_msec"))) {
|
||||
incr_search = p_add;
|
||||
} else if (incr_search != p_add) {
|
||||
incr_search += p_add;
|
||||
|
||||
Reference in New Issue
Block a user