calref / cboe

Classic Blades of Exile
http://spiderwebforums.ipbhost.com/index.php?/forum/12-blades-of-exile/
Other
169 stars 41 forks source link

dialogxml is too slow/cpu-hungry #227

Open x-qq opened 4 years ago

x-qq commented 4 years ago

Currently, simply having a dialogxml-backed window on screen consumes almost 100% of a powerful CPU core.

dialogxml_too_slow

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.

CelticMinstrel commented 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.)

x-qq commented 4 years ago

callgrind shows this

out

clort81 commented 4 years ago

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?

CelticMinstrel commented 4 years ago

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.

x-qq commented 4 years ago

CPU load was reduced in 1fcbd8e922c59a8f4a58e4c16a4c5b966a87091d. But we still need some form of caching, because currently widgets do too much during redraw.

x-qq commented 4 years ago

Updated callgrind:

out svg