[bug]Abnormal CPU load
Closed this issue · 10 comments
What happend?
When I was using the latest version of giu, I found a CPU exception. You can see the difference in CPU load by using programs packaged in examples/widgets and programs compiled directly to run
Code example
main.go
examples/widgets
To Reproduce
- Run my demo
- will see the crash...
Version
master
OS
windows10
@lzytaro I just did a quick test on macOS, the CPU occupation is 0% when the gui is idle.
@lzytaro I just did a quick test on macOS, the CPU occupation is 0% when the gui is idle.
Sorry, my business pc cannot upload the screenshot. Maybe its only happend on a Windows 10 PC?
go version go1.21.12 windows/amd64
@lzytaro may i ask you to write issue title and description in English pls Thank you!
Also, could you check if example from cimgui-go had the same problem?
Maybe there is any problem with my computer. I tried the same case today, but it works normally. I'll close this issue, sorry to bother you.
I used the fps example in the example directory and used the two versions 0.7.0 and 0.8.1 for a long time. The CPU usage of 0.8.1 is significantly higher than that of 0.7.0. Due to the many changes in the two versions, no specific problem points have been identified for the time being.
The CPU usage of 0.7.0 is about 0%, and that of 0.8.1 is 2-5%. It may not be obvious in high-performance CPU scenarios, but it will be obvious when running on low-performance devices.
The problem here is that the program will fall into a short endless loop while, causing a high CPU load. 0.7.0 used time.Ticker to process the timer in go, so this problem did not occur.
code file:
https://github.com/AllenDang/cimgui-go/blob/main/glfw_backend.cpp
I created a pr to solve this problem AllenDang/cimgui-go#294
Ok! well, Generally I'm in the middle of the forest right now but will try to review asap
Oh i see it's already merged. Could you please create a pr here to upgrade cimgui-go version?
Oh i see it's already merged. Could you please create a pr here to upgrade cimgui-go version?
OK sure, here is it https://github.com/AllenDang/giu/pull/833