godotengine / godot

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

Performance issue with `DebugAdapterProtocol.poll()` #58083

Open tavurth opened 2 years ago

tavurth commented 2 years ago

Godot version

v4.0.alpha.calinou [26b21dc0c]

System information

Mac OSX (Intel 2019)

Issue description

https://github.com/godotengine/godot/blob/09a61cdf53a0b34dd6bfa19da7f097c869a8e145/editor/debugger/debug_adapter/debug_adapter_server.cpp#L51-L59

Causes the following code to get executed every frame:

https://github.com/godotengine/godot/blob/09a61cdf53a0b34dd6bfa19da7f097c869a8e145/editor/debugger/debug_adapter/debug_adapter_protocol.cpp#L965-L968

https://github.com/godotengine/godot/blob/09a61cdf53a0b34dd6bfa19da7f097c869a8e145/core/io/tcp_server.cpp#L90-L99

Which seems to cause a lot of CPU usage on my device.

Screenshot 2022-02-14 at 11 25 53

Steps to reproduce

Open Godot 4.x

Minimal reproduction project

No response

rsubtil commented 9 months ago

There was an internal change that resulted in LSP/DAP peers not disconnecting properly, which was fixed for 4.0.3. Can you confirm if this issue still occurs on the latest release? And if it does, can you check if there's also similarly high CPU usage on gdscript_language_protocol.cpp too? https://github.com/godotengine/godot/blob/baf6b4634d08bc3e193a38b86e96945052002f64/modules/gdscript/language_server/gdscript_language_protocol.cpp#L232-L235