Long loading time on Godot 4.2 due to `Terminal::set_default_theme_items` in `Terminal` constructor
Closed this issue · 1 comments
rpaciorek commented
Adding godot-xterm addon increases the startup time of Godot 4.2 from approximately 7 to 30 seconds. All this extra time is spent on the first call of set_default_theme_items
from Terminal
constructor.
Removing this call:
diff --git a/addons/godot_xterm/native/src/terminal.cpp b/addons/godot_xterm/native/src/terminal.cpp
index 3796240..bb4ff83 100644
--- a/addons/godot_xterm/native/src/terminal.cpp
+++ b/addons/godot_xterm/native/src/terminal.cpp
@@ -95,7 +95,6 @@ void Terminal::_bind_methods()
Terminal::Terminal()
{
- set_default_theme_items();
set_focus_mode(FOCUS_ALL);
max_scrollback = 1000;
fixes the problem and appears to have no side effects.
Additionally, calling set_default_theme_items
from GdScript (after adding the appropriate bind) is quick, so it looks like some problem with the constructor and set_default_theme_items
being called at the wrong time (too early) when Godot is started.
lihop commented
Thanks for identifying this. I found it to be related to godotengine/godot-cpp#1332.
Applying the workaround suggested in https://github.com/godotengine/godot-cpp/issues/1332 resolves the issue.