GTK +(GTKSharp)在Windows中性能较差 [英] GTK+ (GTKSharp) poor performance in Windows

查看:278
本文介绍了GTK +(GTKSharp)在Windows中性能较差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这,就是要跨平台我单声道(C#)项目中,我使用的是GTK的UI。不过有一件事我被注意,我在的Archlinux上网本的性能确实迅速,所以事件,如鼠标悬停和窗口小部件的重新划分等,都是真快。

In my Mono (C#) project that is meant to be cross-platform, I am using the GTK for the UI. However one thing I noticed is, on my netbook in Archlinux, the performance is really speedy, so events such as mouse hover, and redrawing of widgets, etc, are really fast.

相较于双核CPU窗口(7),表现真的很薄弱。这困扰我。

Compared to windows (7) on dual core CPUs, the performance is really really weak. Which perplexes me.

我是不是做错了什么是warranting在操作系统之间的性能这种差异?

Am I doing something wrong that is warranting this difference in performance between OSes?

什么有一些方法我可以做优化GTK在Windows?它真的糟糕到需要大约0.5秒的悬停事件踢,而其对Linux的弱(ER)的上网本几乎是立竿见影的。

What are some ways I can do to optimize GTK on Windows? Its really bad to take around 0.5 secs for a hover event to kick in whereas its almost immediate on a weak(er) netbook with Linux.

我的代码是在这里为GUI层: http://code.google。 COM / p / subsynct /来源/浏览/分支机构的/ dev / subsync#subsync / GUI

My code is here for the GUI layer: http://code.google.com/p/subsynct/source/browse/branches/dev/subsync#subsync/GUI

谢谢!

推荐答案

真正的问题是与图形库GTK使用。开罗。您说得对,GTK执行相比于Windows的Linux和其他操作系统好很多。这表明,其实这个问题实际上不是与整个开罗图书馆。它是在开罗的 Win32的后端的。按照后端的信息在开罗文件;开罗使用的xlib 并在一些情况下开罗-GL (想想定制的OpenGL)与Linux和其他平台上工作。虽然在Windows上,它使用的Win32 GDI 这毕竟是一个有点慢和过时的(更不用提完全软件渲染)。

The real problem is with the Graphics Library GTK uses. Cairo. You are right in saying that GTK performs a lot better on Linux and other Operating Systems as compared to Windows. That suggests that in fact the problem isn't actually with the entire Cairo Library. It is in the Win32 backend of Cairo. According to the Backend-Info in Cairo Docs; Cairo uses xlib and in some cases cairo-gl (think customized OpenGL) to work with on Linux and other platforms. While on Windows it uses Win32 GDI which, after all is a bit slow and outdated (not to mention completely software rendered).

不过,即使这并不能完全解释的GTK在Windows上表现不佳。另一个问题可能是,与其使用原生窗口部件,GTK喜欢画它自己的小部件这看起来几乎一样在所有平台上。但是在Windows上它也试图的emulate 本土使用 LibWimp 以进一步增加本机​​外观部件。这额外的Windows的唯一步骤也可以解释的性能开销。看到这对youself,请尝试删除(或重命名)在GIMP目录libwimp.dll。 GIMP运行后(虽然看起来有点非原生)快了很多。

Still, even this doesn't account completely for the poor performance of Gtk on Windows. Another problem may be that instead of using native Widgets, Gtk prefers to draw it's own widgets which look the almost the same on all platforms. However on Windows it also tries to emulate the native widgets using LibWimp to further increase native look and feel. This extra Windows-only step may also account for performance overhead. To see this for youself, try deleting (or renaming) libwimp.dll in the GIMP directory. GIMP runs a lot faster after that (though looked a little non-native).

还有其他较小的因素,可能会或可能不会影响基于GTK的Windows上的表现一样,事实上,GTK有像12-15额外的dll的一个额外的运行时间相比,它有像其他1-2个工具包。动态链接整个GTK运行可能大大增加启动时间。此外,还有基于GTK使用了大量的如油嘴,的攀高,当然,的开罗。写作胶水代码这些库还增加了大量的开销,以及有时甚至一个的额外的的库如 GDK

There are also other smaller factors that may or may not affect Gtk's performance on Windows, like the fact that GTK has an extra runtime with like 12-15 extra dll's compared to other toolkits which have like 1-2. Dynamically Linking the entire Gtk Runtime may greatly increase startup time. There is also the fact that Gtk uses a lot of other libraries like Glib , Pango , and of course , Cairo . Writing glue code for these libraries also adds a lot of overhead , and sometimes even an extra library like Gdk .

要优化的Gtk你可以尝试改变开罗的后端(难,unreccomended并要求另吨胶水代码)或停止使用libWimp(这将使得基于GTK看起来不那么本机)。但总体而言,我认为GTK是不是的的慢。我从来没有亲自需要使用任何优化。虽然我用WINAPI在过去的了。

To optimise Gtk you may try changing the backend of Cairo (difficult , unreccomended and requires another ton of glue code) or stop using libWimp (this will make Gtk look less native). But overall I think GTK is not that slow. I've never personally needed to use any optimizations. Even though I used WinApi in the past too.

这篇关于GTK +(GTKSharp)在Windows中性能较差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆