Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% Core utilisation on empty project #42601

Closed
CitrusWire opened this issue Oct 6, 2020 · 10 comments
Closed

100% Core utilisation on empty project #42601

CitrusWire opened this issue Oct 6, 2020 · 10 comments

Comments

@CitrusWire
Copy link

Godot version:
3.2.3 x64

OS/device including version:
Windows 7; OpenGL ES 3.0 Renderer: GeForce GTX 1050/PCIe/SSE2

Issue description:
A completely empty project when run uses 100% of a CPU Core. It's the compiled application that's doing it, not the editor, and it only does it when it's open; if I minimise the application the resource use goes to 0. Re-open the window (even in the background), and it's back to 100%.

It's not the debug component because I exported it into a .exe (using the defaults) and ran that, with and without DEBUG. Both exhibited the exact same behaviour.

Yet the Godot Editor itself doesn't exhibit this problem, and that being a Godot project...

This may seem minor but:

  • It drains batteries faster.
  • On a global scale across all installs, it may waste a fair amount of electricity and contribute to the environmental consequences thereof.

Steps to reproduce:
Start Godot Editor. Create a new project. Give it a "Node 2D". Save Scene. Run project (pointing to that scene as the "main" scene).

Minimal reproduction project:
See Repro steps

@Calinou
Copy link
Member

Calinou commented Oct 6, 2020

It's the compiled application that's doing it, not the editor,

This is expected. By default, the application will redraw as fast as it can, only limited by V-Sync. If you disable V-Sync in the Project Settings (or your graphics driver manages to forcibly disable it), it may render at thousands of frames per second.

In contrast, the editor has low-processor usage mode enabled. This means it only redraws when something actually changes on screen. You don't want to use that option in most games as it will negatively impact smoothness.

PS: Godot doesn't compile anything when you run or export a project. It just copies an export template and creates a PCK file containing scripts and resources alongside.

@CitrusWire
Copy link
Author

CitrusWire commented Oct 6, 2020

Thanks for the clarification (and explanation of Godots "compiling"); it's appreciated.

I understand what you're saying and it makes sense, but I would suggest the default should be changed for the aforementioned reasons. Then suggest to users what settings to tweak to get more smoothness on a documentation page about optimisation (one of https://docs.godotengine.org/en/stable/tutorials/optimization/ say).

I don't pretend to understand the behind-the-scenes stuff of either engine, but I have a basic Windows Unity game I created using their defaults and it uses 0.01% of my CPU when idling at a menu and just 1% when playing.

@clayjohn
Copy link
Member

clayjohn commented Oct 6, 2020

Do you have V-sync disabled? Either through ProjectSettings or through your graphics driver settings?

If you have V-sync enabled and you are still experiencing this issue, then it may be a bug. But we need way more information to be able to help you.

@bruvzg
Copy link
Member

bruvzg commented Oct 6, 2020

If you need behavior similar to the editor (e.g. UI app that does not need constant redraws/physics updates) you can enable low processor mode Project SettingsGeneralApplicationRunLow Processor Mode and adjust sleep interval to limit FPS (default value 6900 is about 144 FPS) Project SettingsGeneralApplicationRunLow Processor Mode Sleep usec

@CitrusWire
Copy link
Author

CitrusWire commented Oct 6, 2020

The settings are Godot (Project) defaults. I've not fiddled with anything yet because I'm still new.

However, having looked, I can see that display/window/vsync/use_vsync is ticked.

Further testing:
Vsync disabled: GPU usage: 49%
Vsync enabled (the default it seems): GPU usage: 1.2%

CPU in both cases seems to be identical. So Vsync has nothing to do with CPU for me; GPU only.


I can confirm that the "Low Processor Mode" setting does reduce CPU & GPU usage to effectively 0.

@lawnjelly
Copy link
Member

Sounds like the windows build needs profiling on an affected machine.

Indeed the CPU percentage should not be more than a couple percent on an empty project with vsync (when profiling linux this is the case for me, and the largest CPU draw is the audio if I remember right).

@luckyabsoluter
Copy link

luckyabsoluter commented Aug 16, 2022

Godot_v3.5-stable_win64
OpenGL ES 3.0
Laptop i3-8145U
Windows 10

[project setting]->[display/window/vsync/use_vsync] true (default true)
[project setting]->[display/window/vsync/vsync_via_compositor] true (default false)

It solved my problem.

By the way, empty project(without debug) has 3% cpu usage, so maybe there is another problem.

@luckyabsoluter
Copy link

luckyabsoluter commented Aug 16, 2022

In my case, Low Processor Mode reduce cpu usage.
However, if go to game scene from empty scene and then go to empty scene again, cpu usage is high (30%).
It is cpu leaking.

@lawnjelly
Copy link
Member

lawnjelly commented Aug 16, 2022

See #53463 .
editor_settings/interface/editor/show_update_spinner set to true.
Then left click on the update spinner in the top right, and choose update_vital_changes.

This should hopefully reduce CPU quite a bit for you. The other CPU hog is the audio. I did a PR to fix this #63458 , but it has not been progressed to merging (I think Juan wants to research this more).

You can also run with the dummy audio server in the editor with a command line option, which will reduce the audio processing (just less user friendly).

@Calinou
Copy link
Member

Calinou commented Mar 3, 2023

Closing in favor of #39758, which is essentially the same issue. This is addressed in 3.x with the Vital Redraws Only editor setting, but it's not ported to 4.x yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants