Martin Gräßlin, the German maintainer of KWin, has been working on some performance work for KWin, which he's documented in a blog post.
Gräßlin has found several areas for improvement, some of which are bug-fixes that will land for the KDE 4.9.2 point release while the other changes aren't acceptable until KDE SC 4.10. Some of his key work includes:
- "Now looking at the results I saw that the translucency effect is rather expensive and that by default the effect is not doing anything unless you are moving windows. This is of course a rather unpleasant behavior to have an expensive effect doing nothing. So I looked at the implementation and found a way to better track when the effect should be active. Unless you have enabled the effect to set decorations or inactive windows to translucent the effect is now disabled by default. Just when you start moving a window the effect gets active. And even then the effect performs better."
- "I noticed that there is supposed to be an animation when a window starts to move, but personally I have never seen it. Looking closer at the code I noticed that this could have never worked. I decided that an animation added to 4.1 which has never worked can be dropped which again improves a little bit the performance. We might add a better translucency effect for 4.10 which adds the animation again, but for 4.9.x there is no user visible change by removing the animation."
- Finding multiple hacks to remove.
- The big one: "But the main optimization of this method will be available in 4.10. The output of callgrind showed that this method was causing quite some expensive dynamic casts. In fact each call caused two dynamic casts to check whether it is a specific sub class and basically the method contained two interwoven implementations for the two specific sub classes. The logical step was to make the method pure virtual and implement it in the sub classes. According to the callgrind logs after the change this improves the performance quite a lot."
This is nice that the KWin compositing window manager continues to be improved and the KDE desktop becomes faster while other desktops / window managers are moving in the wrong way.