Is it normal that performance of “dotted” linestyle is much slower than “dashed” linestyle?
I have an application written in C++ using Qt4.4.3 on Linux.
Doing some benchmarking, I create a large number of rectangles and compare the difference of performance of drawing various line styles. The worst performance is the “dotted” line style, the “dashed” line style is much faster.
It would seem to me that these should not vary so much.
Is this expected behavior or a bug that should be reported?
Some more details:
I created 100K rectangles using the following pseudo Tcl commands:
for {set i 0} {$i < 100000} {incr i} {
RectCreate [Box [expr 0.001 * $i] 0 [expr 0.001 * ($i + 1)] 100]
}
The rectangles have only their outline drawn. I measured time of redraw for different lineStyles. E.g. for “dots” linestyle:
He开发者_Python百科re are the times I saw with VNC display:
solid line: 0.7 sec
dots: 17.0 sec
dashed: 9.5 sec
longer dashes: 5.7 sec
And on a local display:
solid line: 0.1 sec
dots: 8.9 sec
dashed: 5.7 sec
longer dashes: 3.5 sec
The graphic stack is far too complex for an easy answer. Things that may be "intuitive" will work completely different in practice.
Not an answer, but I suggest you take a look at this blog for some insight on Qt/KDE graphics and how things are not as obvious as they seem.
http://zrusin.blogspot.com/search?q=performance
精彩评论