imgui-ws icon indicating copy to clipboard operation
imgui-ws copied to clipboard

High CPU usage with demo-null

Open hinxx opened this issue 2 years ago • 1 comments
trafficstars

I've running demo-null locally and it seems my browser (brave) on Linux is using a lot of CPU resources in >10 threads when just visiting http://localhost:5000. I'm not even interacting with the UI. As soon as I close the tab with the UI the CPU load on those threads goes to 0 %.

Screenshot_2023-09-26_09-31-25

Is this expected?

hinxx avatar Sep 26 '23 07:09 hinxx

I also observe a high CPU usage under macOS with demo_null.

However, I'm not sure whether it is a real issue or an issue with the measuring tools. Let me explain:

Under Firefox (macOS, mac M1)

I observe 45% CPU usage Here is what I see with Firefox profiling tools: No significant time is taken by the JavaScript code.

image

Most of the time is spent inside a native call to GetRunnableForMTTask which is probably part of the TaskController API. GetRunnableForMTTask in turn calls __psynch_cvwait (which is probably waiting for a condition variable).

Is this wait really active, or is this counted as using CPU when it is not, I don't know.

Safari: no CPU spike

I did not observe a significant CPU spike with Safari.

Chrome: CPU usage raises I do observe a significant CPU spike (about 40%).

However, when running the performance profiler, I could only observe the JavaScript performance, which is not causing the CPU load (it took 200ms on a 10 second profiling session)

image

pthom avatar Apr 18 '24 15:04 pthom