表现“点状”正常吗? linestyle 比“dashed”慢得多。线条风格?

发布于 2024-09-09 04:14:25 字数 688 浏览 3 评论 0原文

我有一个在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

穿透光 2024-09-16 04:14:25

图形堆栈太复杂,无法简单回答。可能“直观”的事情在实践中会完全不同。

不是答案,但我建议您看一下此博客,了解有关 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文