[Gambas-devel] Perfomance differences between gb.gtk and gb.qt components

Benoit Minisini gambas at ...1...
Mon Dec 3 12:51:15 CET 2007


On lundi 3 décembre 2007, José Luis Redrejo wrote:
> I attach here a simple example: its a form with a lot of widgets, but only
> this code:
> PUBLIC SUB Form_Open()
>     PRINT "before"
>       WAIT 1
>       PRINT "after"
>
> END
>
> You can see as it takes ages between printing "before" and "after" in the
> console.
> The funniest thing: if you add a timer to the form, it behaves right.
> This didn't happen before the loop event fixes for gtk.

Thanks for the project, I will look at it. Maybe the problem is in the 
implementation of WAIT in the gb.gtk component...

>
> On the other hand, it's a little ridiculous the thread about the gtk
> slowness vs qt speed. Whenever I start qt applications from a Gnome desktop
> qt (and specially kde) apps need a long time to start. If you're a kde user
> you'll notice the same with gtk applications. It's not a question of which
> platform is fastest, it's a question of merging them.
> I'm not going to be the advocate of gtk (some of its libraries suck) but
> some of the things I've read in the last days are a nonsense.
>
> Cheers.
> José L.
>

The GTK+ slowness is not in the program startup, but in the behaviour of the 
GUI. 

I think that the slowness comes from the following points:

1) The implementation of X11 drawing is slower in GTK+ than in QT. I noticed 
that when comparing for example the GameOfLife example run with gb.qt to the 
same run with gb.gtk. QT has many optimizations in its X11 support, mainly in 
the way it caches X11 graphic contexts, that apparently GTK+ does not have.

2) In gb.qt, I could easily get rid of all the QT layout routines. But not in 
gb.gtk. And by tracing some gb.gtk applications, I noticed that the GTK+ 
layout routines make a *lot* of calls of C routines deeply imbricated. That 
makes thing slower too.

3) Apparently, when a lot of X11 paint events or resize events are received, 
QT compress them, but not GTK+. Or it does it in a different way. You notice 
that when resizing a form: gb.gtk tries to react at each resize event, not 
gb.qt.

But only a GTK+ expert could tell us...

Regards,

-- 
Benoit Minisini




More information about the Devel mailing list