summaryrefslogtreecommitdiffstats
path: root/core/object/class_db.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/object/class_db.cpp')
-rw-r--r--core/object/class_db.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp
index a602dc9fb8..d920ae6ca0 100644
--- a/core/object/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -53,6 +53,7 @@ MethodDefinition D_METHODP(const char *p_name, const char *const **p_args, uint3
#endif
ClassDB::APIType ClassDB::current_api = API_CORE;
+HashMap<ClassDB::APIType, uint64_t> ClassDB::api_hashes_cache;
void ClassDB::set_current_api(APIType p_api) {
current_api = p_api;
@@ -165,6 +166,10 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
OBJTYPE_RLOCK;
#ifdef DEBUG_METHODS_ENABLED
+ if (api_hashes_cache.has(p_api)) {
+ return api_hashes_cache[p_api];
+ }
+
uint64_t hash = hash_murmur3_one_64(HashMapHasherDefault::hash(VERSION_FULL_CONFIG));
List<StringName> class_list;
@@ -290,7 +295,9 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
}
}
- return hash_fmix32(hash);
+ hash = hash_fmix32(hash);
+ api_hashes_cache[p_api] = hash;
+ return hash;
#else
return 0;
#endif