The CPU usage is consistently very low on my computer. I still
don't know what could be causing it for you, but maybe it is
the temporary garbage... let us know if the new patches make a
difference there.
Ok, I tried the breaking at random method and I always ended up
in system code and no stack trace to... seems it was an alternate
thread(maybe GC?). I did a sampling profile and got this:
Function Name Inclusive Exclusive Inclusive % Exclusive %
_DispatchMessageW@4 10,361 5 88.32 0.04
[nvoglv32.dll] 7,874 745 67.12 6.35
_GetExitCodeThread@8 5,745 5,745 48.97 48.97
_SwitchToThread@0 2,166 2,166 18.46 18.46
So possibly it is simply my system and graphics card. For some
reason NVidia might be using a lot of cpu here for no apparent
reason?
DispatchMessage is still taking quite a bit of that though?
Seems like someone else has a similar issue:
https://devtalk.nvidia.com/default/topic/832506/opengl/nvoglv32-consuming-a-ton-of-cpu/
https://github.com/mpv-player/mpv/issues/152
BTW, trying sleep in the MSG loop
Error: undefined identifier 'sleep', did you mean function
'Sleep'?
"import core.thread; sleep(10);"
;)
Adding a Sleep(10); to the loop dropped the cpu usage down to
0-1% cpu!
http://stackoverflow.com/questions/33948837/win32-application-with-high-cpu-usage/33948865
Not sure if that's the best approach though but it does work.
They mention to use PeekMessage and I don't see you doing that,
not sure if it would change things though?