faster paint tree traversal

Dirk Mueller mueller at kde.org
Wed Feb 11 04:54:07 CET 2004


Hi, 

from-the-micro-optimisation-dept.: The split into RenderObject::paint() 
and ::paintObject() is no longer useful, and since both are virtual and have 
like 10 parameters (which are all pushed on the stack etc), this is a 
significant cpu cycle waster. At least on AMD Athlon CPU's the stack pushes 
are terrible slow. 

so I went ahead and merged all the stuff we currently pass around into a 
PaintInfo structure which is allocated once and then only passed by 
reference. Also, paintObject was merged into paint(), reducing 20% of the 
virtual method calls (there is one, isRoot() in RenderBlock::paint() that 
really hurts with over 30% of the total CPU time, but I didn't manage to get 
rid of that one yet). 

The total patch is quite a few dozen kb, but its essentially just fixing the 
compilation errors triggered by the appended patch. 

would this be something you'd be interested in merging? It doesn't have that 
much of a user-noticeable speedup, but it certainly helps in some 
pathological cases (though we need something better for long documents like 
the stuff on my todo list). It is in the ~ 3-5% speedup range.


Dirk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fastpaint.diff
Type: text/x-diff
Size: 1684 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/khtml-devel/attachments/20040211/72aa5472/fastpaint.bin


More information about the Khtml-devel mailing list