GTK 2.0 5 times slower than 1.2



I am porting software from GTK version 1.2 to version 2.0
and I encountered the problem that the GTK 2.0 version
takes much longer to initialize (up to 5 times with simple
programs) than the GTK 1.2 version. The increase in
communication with the X server seems to be at least part
of the phenomenon.

Also the way GTK 2.0 behaves seems to be extremely dependend
on the version of the X server used and if any GTK 2.0
application has run before. Below you can see the results
of my experiments with different GTK and X server versions.

In addition you will find the source code of the program I
used to perform the tests.

I would be thankful for any hint how to reduce the
initialization time of GTK 2.0 applications and/or how to
reduce or speed up communication with the X server.

[ System specifications:
  AMD K6 300MHZ
  96MB Memory
  768kBit DSL Connection
  Graphic card: ATI Technologies Inc 3D Rage LT Pro AGP-133 (rev 220)
]

Sebastian Eken
eken bfw-online de

GTK 1.2:
  libbgtk-1.2.so.0
  libgdk-1.2.so.0
  libglib-1.2.so.0
  libX11.so.6
  libc.so.5

GTK 2.0:
  libgtk-x11-2.0.so.0
  libgdk-x11-2.0.so.0
  libglib-2.0.so.0
  libX11.so.6
  libc.so.5
  libgdk_pixbuf-2.0.so.0
  libpangox-1.0.so.0
  libpango-1.0.so.0
  libatk-1.0.so.0
  libgobject-2.0.so.0
  libgmodule-2.0.so.0


I have run the tests several times and you can regard
the following values as an average of all runs.


          XFree86 Version 3.3.5
                 ---------------------

GTK   Status            Init time     X11 protocol
--------------------------------------------------
1.2   not run before    6 sec         136 packets
1.2   run before        6 sec         147 packets
2.0   not run before    35 sec        1260 packets
2.0   run before        30 sec        727 packets


                 XFree86 Version 3.3.6
                 ---------------------

GTK   Status            Init time     X11 protocol
--------------------------------------------------
1.2   not run before    4 sec         112 packets
1.2   run before        4 sec         111 packets
2.0   not run before    28 sec        2368 packets (!!!)
2.0   run before        8.5 sec       346 packets


And here is the code sample, simple as it is:

#include <gtk/gtk.h>

void
on_window1_destroy (GtkWidget *widget, gpointer data)
{ (void) widget;
  (void) data;
  gtk_main_quit ();
}

GtkWidget*
create_window1 (void)
{ GtkWidget *window1;
  GtkWidget *vbox1;
  GtkWidget *button1;

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window1), 500, 500);
  gtk_object_set_data (GTK_OBJECT (window1), "window1", window1);
  gtk_window_set_title (GTK_WINDOW (window1), "window1");
  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (window1), "vbox1", vbox1,
   (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (window1), vbox1);
  gtk_signal_connect (GTK_OBJECT (window1), "destroy",
   GTK_SIGNAL_FUNC (on_window1_destroy), NULL);
  button1 = gtk_button_new_with_label ("Push me");
  gtk_box_pack_start (GTK_BOX (vbox1), button1, FALSE, FALSE, 0);
  gtk_widget_show (button1);
  return window1;
}

int
main (int argc, char *argv[])
{ GtkWidget *window1;

  gtk_set_locale ();
  gtk_init (&argc, &argv);
  window1 = create_window1 ();
  gtk_widget_show (window1);
  gtk_main ();
  return 0;
}






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