Re: Best place to call gtk_widget_show()?
- From: Iago Rubio <iago iagorubio com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Best place to call gtk_widget_show()?
- Date: Wed, 17 Aug 2005 11:14:27 +0200
On Wed, 2005-08-17 at 09:36 +0200, Stefan Kost wrote:
Hi Markus,
Markus Lausser wrote:
Hello,
I wonder, in which order should the following tasks be done:
* show widget
* add widget to parent container
* add childs to widget
Which order is the fastest (CPU)?
First add childs, then show? First show then add to parent? etc...
Or maybe call gtk_widget_show_all() for the toplevel only?
Does anyone know something about that?
I never measured, but I just build the whole widget tree and then call
_show_all(). Apart from beeing the easiest way, I also belive its most efficient.
_show_all() merely calls the widget class show_all() method, that when
it's a container recurses, and if it's another kind of widget calls
gtk_widget_show().
So I don't think using _show_all() can be quicker than using _show() on
each widget, but it will be indeed easier.
Speaking about cpu cycles, It might be slower _show_all() as there are
some memory access and comparing operations, that will be avoided
calling _show() directly - at least to retrieve the class pointer and to
check if class->show_all != NULL.
Regarding to redraws, if the widget is not a container that's visible
there won't happen any drawing so It should not be slower _show() than
_show_all().
The fastest method may be to show the top level container the last - to
avoid redrawing on screen - but I think it should have nothing to do
with using gtk_widget_show() or gtk_widget_show_all().
--
Iago Rubio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]