Description
I noticed that my application CPU usage was much higher than expected on Windows. On a similar machine I was seeing 1%-2% usage on Linux, and around 20%-30% on Window while moving the mouse in window (just mouse movement).
After some optimization I got my rendering loop down to less than 1ms and still the CPU usage was too high. I then sampled the CPU with https://github.com/nico-abram/blondie/tree/main and this is the flamegraph that it produces:
As you can see, almost 90% of the time, it is calling the make_not_current
function, which seems really excessive...
EDIT: I found in the docs here that this call flushes the rendering context so probably rendering is just very slow... Still not sure why though.
Screenshots
Another flamegraph with Windows Performance Analyzer (similar results):
This shows the call stack a bit deeper:
- opengl32d.dll
wglMakeCurrent
- opengl32d.dll
bMakeNoCurrent
- opengl32d.dll
wglMakeCurrent
- opengl32d.dll
wglMakeCurrent
- opengl32d.dll
wglMakeCurrent
- KernelBase
SetEvent
Desktop (please complete the following information):
- OS: Windows
- Version: egui 0.26