[Scummvm-devel] Wintermute profiling
Willem Jan Palenstijn
wjp at usecode.org
Sat Aug 24 17:57:19 CEST 2013
Prompted by a few recent discussions on Wintermute performance I've done some
profiling last night and this morning (using gprof and manual instrumentation
of parts of the most expensive functions) in the main menu of Rosemary and
the load menu of Chivalry.
By far the most expensive bits in these two screens turn out to be the loops
over the _renderQueue in drawSurface and the functions it calls.
One thing I only explicitly realized due to this profiling is that calling
_renderQueue.size() (_renderQueue is a Common::List) is very expensive as it
doesn't maintain the current size of the list and iterates through it entirely.
This morning I've done some limited refactoring to get rid of these expensive
loops at https://github.com/wjp/scummvm/commits/wme_lineartickets .
That chain of commits first duplicates the logic to a loop-free variant, in the
process also adding asserts to ensure both logic paths give the same results.
The commits after that then replace the old path with the new logic, and clean
up the result.
Because it's only a proof of concept and I wanted to see the behaviour with
lots of tickets (and I was too lazy to handle this properly...), I've just
disabled _tempDisableDirtyRects entirely in that branch.
It also needs more testing. Especially at the point where the double-checking
asserts are still in there to check if all my assumptions are correct.
It would be interesting to see what other problematic screens there are in
Wintermute games, and how this interacts with t0by's dirty rect improvements.
All these things combined should lead to very nice results I think.
More information about the Scummvm-devel