Open x-qq opened 4 years ago
Hmm. I can guess that maybe part of the cause is that it's redoing the text layout (wrapping) every frame? (I don't know whether it is doing that though.)
callgrind shows this
Can we change OpenBoE to only use CPU when user input is received? Just stop the process and children until mouse or keyboard event goes to it?
callgrind shows this
Not quite certain but it seems like that might support my theory, as there seems to be a lot of green around the win_draw_string
area.
Can we change OpenBoE to only use CPU when user input is received? Just stop the process and children until mouse or keyboard event goes to it?
I think it might be possible, since the game is turn-based. The only possible complication would be the animations that should continue to work even while time isn't passing.
CPU load was reduced in 1fcbd8e922c59a8f4a58e4c16a4c5b966a87091d. But we still need some form of caching, because currently widgets do too much during redraw.
Updated callgrind:
Currently, simply having a dialogxml-backed window on screen consumes almost 100% of a powerful CPU core.
For reference, this is Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz.
This is not a reasonable CPU load for some static text and pictures, so I think dialogxml requires some optimization.