表现“点状”正常吗? linestyle 比“dashed”慢得多。线条风格?
我有一个在 Linux 上使用 Qt4.4.3 用 C++ 编写的应用程序。
通过进行一些基准测试,我创建了大量矩形,并比较了绘制各种线条样式的性能差异。性能最差的是“点”线样式,“虚”线样式要快得多。
在我看来,这些应该不会有太大差异。
这是预期的行为还是应该报告的错误?
更多细节:
我使用以下伪 Tcl 命令创建了 100K 矩形:
for {set i 0} {$i < 100000} {incr i} {
RectCreate [Box [expr 0.001 * $i] 0 [expr 0.001 * ($i + 1)] 100]
}
这些矩形仅绘制了轮廓。我测量了不同线条样式的重绘时间。例如,对于“点”线型:
以下是我在 VNC 显示中看到的时间:
solid line: 0.7 sec
dots: 17.0 sec
dashed: 9.5 sec
longer dashes: 5.7 sec
在本地显示上:
solid line: 0.1 sec
dots: 8.9 sec
dashed: 5.7 sec
longer dashes: 3.5 sec
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:
Here 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
图形堆栈太复杂,无法简单回答。可能“直观”的事情在实践中会完全不同。
不是答案,但我建议您看一下此博客,了解有关 Qt/KDE 图形的一些见解以及事情并不像看起来那么明显。
http://zrusin.blogspot.com/search?q=performance
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