1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Optimize Object::get_class_name

* Run the static function once per class instead of one per instance.
* Saves some memory in Object derived classes.
This commit is contained in:
Juan Linietsky
2023-04-07 23:32:37 +02:00
parent 61630d4e1e
commit 8950943356
4 changed files with 28 additions and 17 deletions

View File

@@ -201,6 +201,14 @@ StringName::StringName(const StringName &p_name) {
}
}
void StringName::assign_static_unique_class_name(StringName *ptr, const char *p_name) {
mutex.lock();
if (*ptr == StringName()) {
*ptr = StringName(p_name, true);
}
mutex.unlock();
}
StringName::StringName(const char *p_name, bool p_static) {
_data = nullptr;