godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.82k stars 21.14k forks source link

Moderate Performance Issues Loading Scripts With v4.0 Beta 16 IDE On Linux #72448

Open ghost opened 1 year ago

ghost commented 1 year ago

Godot version

v4.0.beta16.official [518b9e580]

System information

Linux Mint 21.1 Cinnamon 64Bit

Issue description

Hi,

Have moderate performance issues with v4.0 Beta 16 IDE on Linux.

Running Godot Engine v4.0 Beta 16 official Linux on below system:

See steps to reproduce...

Thanks!

Jesse

Steps to reproduce

Minimal reproduction project

Not applicable

Zireael07 commented 1 year ago

Please edit the issue title to mention that it's to do with scripts loading, otherwise it's liable to get closed by mistake as a duplicate of several other general 'Godot 4 feels slow' issues

ghost commented 1 year ago

Ok, done...

Sslaxx commented 1 year ago

How does this compare to previous betas. Have you had this issue before?

Calinou commented 1 year ago

This is likely a duplicate of https://github.com/godotengine/godot/issues/71795, https://github.com/godotengine/godot/issues/71084 and/or https://github.com/godotengine/godot/issues/70869.

How long are each of your scripts? Do they have very long lines? Any specific editor settings you're using?

ghost commented 1 year ago

Please look over the project below: https://github.com/BetaMaxHero/GDScript_Godot_4_T-Story (above is an older release, but 99% similar to what we are using)

Zireael07 commented 1 year ago

@Calinou I don't think it's a dupe of #71795, OP says it's to do with loading the scripts

@BetaMaxHero are there many scripts open (in the IDE list) at the same time?

ghost commented 1 year ago

I have all 8 scripts loaded in the scripts pane. There is a 1-2 second delay switching scripts in the scripts pane. It's not my high-spec Linux computer. Linux IDE requires further optimization.

ghost commented 1 year ago

Checked v4.0 Beta 16 on a Windows 11 Pro 64Bit mid-range SFF desktop. No performance issues on Windows.

This is only affecting Linux.

Calinou commented 1 year ago

Linux IDE requires further optimization.

The rendering code is the exact same – Godot does not use OS-specific libraries for its UI. The most likely cause for the editor performing worse on Linux is that compositing on X11 is notoriously slow compared to Windows.

I recommend using a window manager that doesn't force compositing (such as KWin or Xfwm) and disable compositing while comparing performance with Windows. If this is not an option, enable fullscreen in the editor by pressing Shift + F11 (on both Windows and Linux).

If you can compile from source, try using a C++ profiler on a debug build to see what's taking the most time.

ghost commented 1 year ago

Hi,

Sorry, but I am running Godot Engine v4.0 Beta 16 on Windows 11 Pro 64Bit now... I have a hard deadline for releasing "Release Candidate 1".

Let me get this game out the door in about two weeks(or less), and I will revisit the performance issues on my Linux.

Thanks!

Jesse

ghost commented 1 year ago

"The most likely cause for the editor performing worse on Linux is that compositing on X11 is notoriously slow compared to Windows."

Calinou commented 1 year ago
  • I don't agree - this desktop runs Doom(2016) at 1080P on "High" settings...

Fullscreen games suspend compositing, while the Godot editor is a windowed application (at least by default).

ghost commented 1 year ago

Ok, I'll revisit this in a couple of days - thank you!

Paulb23 commented 1 year ago

Cloned: https://github.com/BetaMaxHero/GDScript_Godot_4_T-Story

Spent some time switching between tabs using HotSpot, can confirm it take a second or so, seems like most of the time is spent parsing GDScript (bottom-up view from HotSpot):

image

Here's the full callstack with the "top" time consumers when switching:

method cycles:u
ScriptEditor::_script_selected(int) 32.8%
ScriptEditor::_go_to_tab(int) 32.8%
ScriptEditor::_update_members_overview() 27.8%
ScriptTextEditor::get_functions() 31.8%
GDScriptLanguage::validate(String const&, String const&, List<String, DefaultAllocator>, List<ScriptLanguage::ScriptError, DefaultAllocator>, List<ScriptLanguage::Warning, DefaultAllocator>, HashSet<int, HashMapHasherDefault, HashMapComparatorDefault >) const 31.8%
GDScriptParser::parse(String const&, String const&, bool) 32%
GDScriptParser::parse_program() 66.8%
GDScriptParser::parse_class_body(bool) 66.8%
void GDScriptParser::parse_class_member(GDScriptParser::FunctionNode(GDScriptParser::)(), GDScriptParser::AnnotationInfo::TargetKind, String const&) 67%
GDScriptParser::parse_function() 66.6%
GDScriptParser::parse_suite(String const&, GDScriptParser::SuiteNode*, bool) 66.1%
GDScriptParser::parse_statement() 66.4%
GDScriptParser::parse_if(String const&) 52.9%
GDScriptParser::parse_expression(bool, bool) 37.8%
GDScriptParser::parse_precedence(GDScriptParser::Precedence, bool, bool) 52.1%
GDScriptParser::advance() 36%
GDScriptTokenizer::scan() 55.7%
GDScriptTokenizer::potential_identifier() 50.0%
TextServerAdvanced::is_confusable(String const&, Vector const&) const 48.2%
uspoof_getSkeleton_72_godot 40.8%
uspoof_getSkeletonUnicodeString_72_godot(USpoofChecker const, unsigned int, icu_72_godot::UnicodeString const&, icu_72_godot::UnicodeString&, UErrorCode) 37.4%
icu_72_godot::SpoofData::confusableLookup(int, icu_72_godot::UnicodeString&) const 25.4%
Calinou commented 1 year ago

It seems ICU's is_confusable() implementation is taking a lot of time. cc @bruvzg