Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dialogxml is too slow/cpu-hungry #227

Closed
x-qq opened this issue Jan 8, 2020 · 7 comments
Closed

dialogxml is too slow/cpu-hungry #227

x-qq opened this issue Jan 8, 2020 · 7 comments
Labels
bug dialogxml Affects the dialog system

Comments

@x-qq
Copy link
Contributor

x-qq commented Jan 8, 2020

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
Copy link
Member

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
Copy link
Contributor Author

x-qq commented Jan 9, 2020

callgrind shows this

out

@clort81
Copy link

clort81 commented Jan 9, 2020

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
Copy link
Member

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
Copy link
Contributor Author

x-qq commented Jan 21, 2020

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

@x-qq
Copy link
Contributor Author

x-qq commented Jan 21, 2020

Updated callgrind:

out svg

@CelticMinstrel CelticMinstrel added bug dialogxml Affects the dialog system labels Jan 22, 2020
This was referenced Aug 9, 2024
@NQNStudios
Copy link
Collaborator

I'm making a single issue to track CPU-related concerns: #450

Note that this specific issue has been mostly solved. We know that multiline text fields are still slow, something that I've noted in the new issue, but those only exist in the scenario editor which isn't the current top priority.

@NQNStudios NQNStudios closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dialogxml Affects the dialog system
Projects
None yet
Development

No branches or pull requests

4 participants