diff options
author | kobewi <kobewi4e@gmail.com> | 2023-05-05 15:23:25 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2023-05-05 17:34:49 +0200 |
commit | 30d0dd43c58565809766683326535597f3dd39ea (patch) | |
tree | c58e41d26ba6084b2c372727fe2aa53ad8b7d4ef /core/core_bind.cpp | |
parent | f6bf51ca49ed0073a3c34054a7ab583faff2d3ec (diff) | |
download | redot-engine-30d0dd43c58565809766683326535597f3dd39ea.tar.gz |
Cache feature list in OS.has_feature()
Diffstat (limited to 'core/core_bind.cpp')
-rw-r--r-- | core/core_bind.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 50587bb402..a13168beed 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -423,7 +423,14 @@ Error OS::set_thread_name(const String &p_name) { }; bool OS::has_feature(const String &p_feature) const { - return ::OS::get_singleton()->has_feature(p_feature); + const bool *value_ptr = feature_cache.getptr(p_feature); + if (value_ptr) { + return *value_ptr; + } else { + const bool has = ::OS::get_singleton()->has_feature(p_feature); + feature_cache[p_feature] = has; + return has; + } } uint64_t OS::get_static_memory_usage() const { |