godotengine / godot

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

Slow editor/project startup time Godot 4.0-stable #78039

Open adcoding opened 1 year ago

adcoding commented 1 year ago

Godot version

4.0-stable

System information

Windows 11 - Godot v4.0-stable - AMD Ryzen 5 7600X - Radeon RX 6800 16G

Issue description

Opening the Project Manager and running a project in the editor in Godot 4.0-stable is slow.

4.0-stable:

Godot Engine v4.0.stable.official.92bee43ad - https://godotengine.org
OpenGL API 3.3.0 Core Profile Context 23.4.3.230420 - Compatibility - Using Device: ATI Technologies Inc. - AMD Radeon RX 6800

STARTUP BENCHMARK:
        - core :  0.008997  sec.
        - servers :  20.403408  sec.
        - scene :  0.076377  sec.
        - project_manager :  0.27369  sec.
        - total_time :  20.768751  sec.

4.0.1-stable:

Godot Engine v4.0.1.stable.official.cacf49999 - https://godotengine.org
OpenGL API 3.3.0 Core Profile Context 23.4.3.230420 - Compatibility - Using Device: ATI Technologies Inc. - AMD Radeon RX 6800

STARTUP BENCHMARK:
        - core :  0.010883  sec.
        - servers :  20.370848  sec.
        - scene :  0.074814  sec.
        - project_manager :  0.26566  sec.
        - total_time :  20.728743  sec.

4.0.3-stable:

OpenGL API 3.3.0 Core Profile Context 23.4.3.230420 - Compatibility - Using Device: ATI Technologies Inc. - AMD Radeon RX 6800

STARTUP BENCHMARK:
        - core :  0.008548  sec.
        - servers :  20.395994  sec.
        - scene :  0.06646  sec.
        - project_manager :  0.207452  sec.
        - total_time :  20.684741  sec.

Steps to reproduce

Put the Godot build in the projects folder and type the following into the command line:

./Godot_v4.0-stable_win64.exe --startup-benchmark -e

Minimal reproduction project

N/A -- can be seen by running the editor.

akien-mga commented 1 year ago

Thanks for the detailed report. Given that it spends 20 s in the servers initialization, my current guess would be that it can be related to initializing the RenderingServer, though that still needs to be confirmed. CC @lawnjelly @clayjohn who can maybe advise how to debug further.

AThousandShips commented 1 year ago

Could it be related to initializing the text server? Not sure what's happening when loading fonts and data there? For project startup, can we test with the fallback server (afair the advanced server is required for the editor)?

akien-mga commented 1 year ago

Could it be related to initializing the text server? Not sure what's happening when loading fonts and data there? For project startup, can we test with the fallback server (afair the advanced server is required for the editor)?

This hypothesis could be tested by adding --text-driver Dummy on the command line (it will break all text rendering, but if it's much faster, that would indeed be a good indication of the culprit).

Calinou commented 1 year ago

Does this only occur on the first startup? See https://github.com/godotengine/godot/issues/74292.

AThousandShips commented 1 year ago

This is for compatibility, which afik doesn't use cache in 4.0.x

adcoding commented 1 year ago

Does this only occur on the first startup? See #74292.

It happens every time on the following three occasions:

lawnjelly commented 1 year ago

Gold standard would be for the OP to run a profiler on their machine, with a build that contains program database so that can give function names. e.g. https://github.com/VerySleepy/verysleepy works on windows.

For the build, I am not sure whether @Calinou or @akien-mga have any builds available with program database.

It's kind of hard to guess otherwise. Also it could be something GPU side causing the slowdown, which might not show on the CPU profile (but it would hopefully show a lot of time waiting for the GPU).

Calinou commented 1 year ago

For the build, I am not sure whether @Calinou or @akien-mga have any builds available with program database.

I have https://github.com/Calinou/godot-debug-builds but it doesn't have 4.0.1-4.0.3 yet, only 4.0.

adcoding commented 1 year ago

Update: I'm having the same issue also with Godot 4.1

Another curious thing I've noticed is that one day I ran the editor as usual and it was super fast. But then (the next day, it was again super slow)

Calinou commented 1 year ago

Another curious thing I've noticed is that one day I ran the editor as usual and it was super fast. But then (the next day, it was again super slow)

Updating your Godot version and/or graphics driver invalidates the shader cache, so shaders must be compiled again.

73v3 commented 1 year ago

I was experiencing similar issues - with 20 second or more delays between pressing run and app execution. It also displayed this behaviour off and on which I don't think was related to driver updates as it was too erratic:

"Another curious thing I've noticed is that one day I ran the editor as usual and it was super fast. But then (the next day, it was again super slow"

I simulated a clean install by deleting:

.godot in my project folder appuserdata project folder [AppData\Roaming\Godot] AppData\Local\Godot folder

and the problem went away. Worth trying?

System: Godot Engine v4.1.1.stable.official.bd6af8e0e (and prev 4.x releases), OpenGL API 3.3.0 NVIDIA 472.47 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 2070 SUPER Win 10. i7-6700, 32GB RAM.

MaasTL commented 1 year ago

I upgrade my PCs GPU running Fedora Linux from NVIDIA GeForce 1050 TI to AMD Radeon RX 7600 and this issue started happening to me too. Everytime I open or run a project it takes a very long time. Everything else runs smoothly.

Calinou commented 1 year ago

I upgrade my PCs GPU running Fedora Linux from NVIDIA GeForce 1050 TI to AMD Radeon RX 7600 and this issue started happening to me too. Everytime I open or run a project it takes a very long time. Everything else runs smoothly.

Which Godot version are you using? Do you see a warning about Vulkan pipeline cache when starting the editor or project? This should only appear on the first startup of each project, not every time. See https://github.com/godotengine/godot/issues/81150.

MaasTL commented 1 year ago

I upgrade my PCs GPU running Fedora Linux from NVIDIA GeForce 1050 TI to AMD Radeon RX 7600 and this issue started happening to me too. Everytime I open or run a project it takes a very long time. Everything else runs smoothly.

Which Godot version are you using? Do you see a warning about Vulkan pipeline cache when starting the editor or project? This should only appear on the first startup of each project, not every time. See #81150.

This is my Terminals output, when running Godot 4.1.1 and getting a long delay (about 20 seconds) on project opening:

[tobi@pc Godot]$ ./"Godot_v4.1.1-stable_linux.x86_64" Godot Engine v4.1.1.stable.official.bd6af8e0e - https://godotengine.org OpenGL API 4.6 (Core Profile) Mesa 23.1.6 - Compatibility - Using Device: AMD - AMD Radeon Graphics (gfx1102, LLVM 16.0.6, DRM 3.52, 6.4.12-200.fc38.x86_64)

Editing project: /home/tobi/Godot/Projects/puzzle-of-gods Godot Engine v4.1.1.stable.official.bd6af8e0e - https://godotengine.org [tobi@pc Godot]$ Vulkan API 1.3.246 - Forward+ - Using Vulkan Device #0: AMD - AMD Radeon Graphics (RADV GFX1102)

EDIT: Godot v3.5.2.stable.official.170ba337a works just fine and opens or runs a project nearly instantly: Godot Engine v3.5.2.stable.official.170ba337a - https://godotengine.org OpenGL ES 3.0 Renderer: AMD Radeon Graphics (gfx1102, LLVM 16.0.6, DRM 3.52, 6.4.12-200.fc38.x86_64) Async. shader compilation: OFF

MaasTL commented 1 year ago

Alright so I just updated my Fedora System with todays System Update AND uninstalled the NVIDIA Graphics Drivers Control Panel And the delay is gone! I can't particularly address if it was the update or the uninstall as I did them at the same time before testing again. Now I'm feeling kinda stupid, as this doesn't seem to be a Godot 4.x issue anymore :(

PS: As for this issue not being only Godot 4.x related: It also occurred when using Bevy Engine. So I think it's more of a Vulkan -> Linux -> new Radeon 7600 issue.

codymerhoff commented 10 months ago

Hi all, just throwing my info in the ring. I just recently started having this issue yesterday (which was November 19th, 2023). I've been using the same version of Godot (v4.1.1.stable.official.bd6af8e0e) for a couple of months now. Up until yesterday, booting was very snappy.

Then, starting yesterday, I clocked the start up time (with my cell phone's stopwatch, not terribly scientific, I know) to about 32 seconds. This occurs on pretty much all aspects of Godot:

I downloaded a newer version (with C# support) (v4.1.3.stable.mono.official.f06b6836a) and it has the same issue.

The only thing I did on yesterday before this started happening was reboot my computer for unrelated reasons. The issue began after restart. This reboot did not apply any OS updates to my knowledge.

This makes me think that something on my machine changed when I rebooted? But I don't know what. I've restarted my machine before without running into this issue.

Machine Info: OS - Windows 11 x64 Processor: AMD Ryzen 9 3960X 16-Core RAM: 64 GB 3600 MHz Graphics Card: Nvidia RTX 3080 Ti