How to drastically boost up your KDE 4 performance by using the Qt raster rendering engine
The release of the KDE SC version 4 series hasn’t been a success story in the first place. The first versions of KDE 4 are known to be buggy and slow. But the situation is constantly getting better. And since the release of KDE SC 4.3, it may be stated that the KDE software collection is quite useful in a productive environment. However, although the performance of KDE is constantly improving, it has never reached a state so far where it felt completely fast to me (such as GNOME, KDE 3, or lightweight desktop environments like XFCE, LXDE, or fluxbox do). A little bit of bubble gum always remained.
Until I found the »raster engine« of Qt. Qt can use different ways of painting widgets on your screen. On GNU/Linux and other Unix-like operating systems, Qt normally uses the X11/XRender method for that. But since Qt version 4.5, you can also instruct Qt to use the raster engine on X11 instead. The raster engine is the reference rendering engine of Qt 4, and it is used as the native painting method on Windows. Roughly speaking, instead of asking the X server to paint some lines, some circles, etc., the raster engine only takes a raw shared memory image buffer from the X server and paints all the stuff it needs on its own into this buffer. Theoretically, the X11/XRender method shouldn’t necessarily be slower, but it is. I won’t get further into the details here, but you can get some deeper information about the Qt raster engine for example here or here.
You can start a Qt program using the raster engine directly by adding the
-graphicssystem raster parameter on the command line. And as you can see, this may have a strong impact on the applications performance. But, as far as I know, there is currently no way of changing the Qt rendering engine globally without recompiling it. There are some workarounds (BTW: You need to add the
/usr/share/autostart/*.desktop directory to the
goraster.sh script posted there for the script to have an effect at system startup), but imho they aren’t very satisfying.
Therefore, I created a PPA repository for Ubuntu Lucid containg Qt compiled with the raster engine enabled. If you have added the Kubuntu backports PPA repository to your software sources to get newer versions of KDE SC, you should use this repository, because the Kubuntu backports PPA provides a newer version of Qt.
With the help of the Debian package versioning scheme, I guarantee that my packages only supersede the corresponding Qt packages of the same version, but not newer ones. This is necessary to keep the package dependencies consistent. I try to update my repositories as soon as a new version appears in the Ubuntu repository or the Kubuntu backports PPA, but I can’t promise to be always fast ;).
Some known issues at the end: The rastering engine can slow down the process of X-forwarding your Qt programs to another desktop, because with raster, complete images need to be transfered through the network instead of (more or less) only X commands. Furthermore, the rastering engine may break the OpenOffice.org KDE integration. Use the
openoffice.org-gtk package instead or start OpenOffice.org with
Have fun! 😉
UPDATE: Since Qt version 4.7, you can globally set the graphicssystem to raster via the
QT_GRAPHICSSYSTEM environment variable. See here. Thanks lelamal for the comment.
UPDATE2: BTW: The easiest way I found to switch to the rastering engine with Qt 4.7 is adding
export QT_GRAPHICSSYSTEM="raster"; to your