From 6631f66c2a9d54dc80d57df60376c84ce1252d08 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 17 Jul 2021 18:22:52 -0300 Subject: Optimize StringName usage * Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor. --- scene/main/scene_tree.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scene/main/scene_tree.cpp') diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index fefe4c9f0d..2a5be0314d 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -406,7 +406,7 @@ bool SceneTree::physics_process(float p_time) { MainLoop::physics_process(p_time); physics_process_time = p_time; - emit_signal("physics_frame"); + emit_signal(SNAME("physics_frame")); _notify_group_pause("physics_process_internal", Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_process_picking"); @@ -436,7 +436,7 @@ bool SceneTree::process(float p_time) { multiplayer->poll(); } - emit_signal("process_frame"); + emit_signal(SNAME("process_frame")); MessageQueue::get_singleton()->flush(); //small little hack @@ -471,7 +471,7 @@ bool SceneTree::process(float p_time) { E->get()->set_time_left(time_left); if (time_left < 0) { - E->get()->emit_signal("timeout"); + E->get()->emit_signal(SNAME("timeout")); timers.erase(E); } if (E == L) { @@ -1097,7 +1097,7 @@ Error SceneTree::change_scene_to(const Ref &p_scene) { ERR_FAIL_COND_V(!new_scene, ERR_CANT_CREATE); } - call_deferred("_change_scene", new_scene); + call_deferred(SNAME("_change_scene"), new_scene); return OK; } -- cgit v1.2.3