gdcef icon indicating copy to clipboard operation
gdcef copied to clipboard

~100% CPU usage by Godot Engine when using v0.11.0-godot4 or higher

Open Pastew opened this issue 1 year ago • 4 comments

Hello,

I noticed there is ~100% CPU usage by Godot Engine when I use cef_artifacts from v0.11.0-godot4 or higher (I also tested 12, 14, 15, same problem).

When I use v0.10.0-godot4 it works fine.

Info

Windows 10
Godot 4.3

How it looks in Task Manager: v0.10.0-godot4 image

v0.11.0-godot4 and higher image

I'm not sure how to debug it.

Pastew avatar Jan 07 '25 21:01 Pastew

This is because openmp consumes a lot of cpu resources when copying buffers. If you change this to “no” and build with CEF_USE_CPU_PARALLELISM = “yes” in build.py, the usage rate will go down. Of course, your performance will go down as well, but unless your resolution is very large (2K or more), you'll probably be fine. Personally, I've been working on an optimization that doesn't use openmp, but it's not good enough to commit yet.

eliopark-nsuslab avatar Jan 08 '25 06:01 eliopark-nsuslab

@eliopark-nsuslab Thank you for your reply! Performance is better with v0.10.0. When I use v0.11.0 browser sometimes is extremally laggy (and sometimes it works fine).

I'm not sure CEF_USE_CPU_PARALLELISM is the culprit. When I look at diff in code between v0.10.0 and v0.11.0 I can see in both cases it's set to "yes". Link do diff: compare/v0.10.0-godot4...v0.11.0-godot4

CEF_USE_CPU_PARALLELISM = "yes"

Pastew avatar Jan 08 '25 10:01 Pastew

@Pastew good point I also suspect the cpu consomption comes from the introduction of openmp. I did not had time to investigate. You can disable openmp and compile back. @eliopark-nsuslab good to hear you have a PR. If you were on the discord Sander made a PR to Godot specially for copying the texture to gpu avoiding extra cpu copy

Lecrapouille avatar Jan 08 '25 17:01 Lecrapouille

@eliopark-nsuslab https://github.com/godotengine/godot/issues?q=is%3Apr%20state%3Aclosed%20author%3Akroketio

Lecrapouille avatar Jan 08 '25 17:01 Lecrapouille