Is GTK+ 3.x 2x slower than GTK+ 2.x?

Is GTK+ 3.x 2x slower than GTK+ 2.x?


When I upgraded to GTK+ 3.0, the first thing that struck me was how 
sluggish it was compared to 2.24. The same dialogs in the same 
application appear immediately on the screen in the 2x version, while 
it takes time to paint them on the screen with the 3.x version. 
Browsing through menus or switching between tabs consumed 2x or 3x more 
CPU cycles in the 3.x version. The file open/save dialog is much slower 
(slower to show up, slower to change directories). Or hovering over the 
toolbuttons in 3.x-based Glade consumed 80% CPU cycles and the 
highlighting could barely keep up with the mouse cursor. Application 
startup is a bit slower with 3.x, too.

So I made a (very) simple and stupid benchmark that tests a couple of 
basic things in a loop, to see how the two GTK+ versions compare. 
If you're interested, you can download it here:

(A simple "make" command should build both versions.)

I am testing it in xfwm4 with compositor turned off. If you test it in 
a compositing WM with window effects (open/close), especially with 
test #3 which opens/closes a dialog 50 times, it may measure something 
else than GTK+ speed...

The default GTK+ theme (Raleigh) was used for both 2.24 and 3.0.11. 
Both GTK+ 2.x and 3.x software was already running, so both library 
versions were loaded in memory (so it was probably not an issue for the 
startup speed).

The results from my 3GHz dual CPU desktop machine with the open-source 
radeon driver (I ran each test 7 times and took the best result for each 

Startup, GTK+ 2: 0.11081 s, GTK+ 3: 0.14468 s
Test 1, GTK+ 2:  4.34362 s, GTK+ 3: 8.83771 s
Test 2, GTK+ 2:  1.72010 s, GTK+ 3: 2.33266 s
Test 3, GTK+ 2:  2.27047 s, GTK+ 3: 4.79270 s

It's not just my computer, as I tried it on an HP 625 laptop, again 
using the radeon driver:

Startup, GTK+ 2: 0.09357 s, GTK+ 3: 0.13600 s
Test 1, GTK+ 2:  3.27795 s, GTK+ 3: 5.20183 s
Test 2, GTK+ 2:  1.47700 s, GTK+ 3: 1.46733 s
Test 3, GTK+ 2:  1.35302 s, GTK+ 3: 5.14810 s

It's not the radeon driver either, as I tried it with the proprietary 
fglrx driver, too:

Startup, GTK+ 2: 0.09058 s, GTK+ 3: 0.13770 s
Test 1, GTK+ 2:  2.42151 s, GTK+ 3: 6.67091 s
Test 2, GTK+ 2:  1.15294 s, GTK+ 3: 1.44557 s
Test 3, GTK+ 2:  1.31779 s, GTK+ 3: 4.64865 s

It's probably not the default theme either. First, the default themes 
look very similar in both versions. Second, test 2 does not seem to be 
influenced by the GTK+ version too much. Third, when I use slow fancy 
themes in both GTK+ versions (Victory, Adwaita, New Wave...), I still 
get the same pattern again - even though a fancy theme makes both 
versions (sometimes even 6x) slower, 3.x is still 50-150% slower than 
2.x (except for test 2, which seems to be mainly influenced by the 
theme itself). And fourth, even a slow fancy GTK+ 2.x theme is faster 
than the plain default 3.x theme.

Finally, it's not my Linux distribution either. I ran the tests in 3 
different distros (Arch Linux, LMDE and Fedora 15, with Xfce in all of 
them), and always got similar results.

So my question is - is there something in GTK+ 3.0 that could possibly 
cause such a dramatic slowdown compared to 2.24?

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]