summaryrefslogtreecommitdiffstats
path: root/core/core_bind.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-05-05 15:23:25 +0200
committerkobewi <kobewi4e@gmail.com>2023-05-05 17:34:49 +0200
commit30d0dd43c58565809766683326535597f3dd39ea (patch)
treec58e41d26ba6084b2c372727fe2aa53ad8b7d4ef /core/core_bind.cpp
parentf6bf51ca49ed0073a3c34054a7ab583faff2d3ec (diff)
downloadredot-engine-30d0dd43c58565809766683326535597f3dd39ea.tar.gz
Cache feature list in OS.has_feature()
Diffstat (limited to 'core/core_bind.cpp')
-rw-r--r--core/core_bind.cpp9
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 {