Re: GtkNotebook - performance



Hi,
we've been developing application for data collection and we needed lot of GtkEntry. The problem is worse in Win32 (aprox. half Linux performance). I've thought that Gtk use double buffering, but when you switch tab you can see repainting of controls. There two phases (1. count control position - draw white rectangles, 2. repaint whole window).
I think that "first phase" should not be visible. Is it correct ?

Thanks. Petr Pytelka

My test application:
 #include <stdio.h>
 #include <stdlib.h>

 #include <gtk/gtk.h>
 #include <gdk/gdkwindow.h>

 int createWindow()
 {
     GtkWidget *nb;
     GtkWidget *wnd=gtk_window_new(GTK_WINDOW_TOPLEVEL);
     int i,f;
     // create notebook
     nb=gtk_notebook_new();
     gtk_container_add(GTK_CONTAINER(wnd),nb);
     // add pages
     for(i=0;i<10;i++)
     {  
        GtkWidget *table=gtk_table_new(10,10,FALSE);
        for(f=0;f<100;f++) {
                GtkWidget *hbox=gtk_hbox_new(FALSE,0);
                GtkWidget *vbox=gtk_vbox_new(FALSE,0);
                char buff[20];
                sprintf(buff,"%i.%i",i,f);            
                GtkWidget *widget=gtk_entry_new();
                gtk_entry_set_width_chars(GTK_ENTRY(widget),f%7+3);
                gtk_entry_set_text(GTK_ENTRY(widget), buff);
                gtk_box_pack_start(GTK_BOX(vbox),widget,FALSE,FALSE,0);
                gtk_box_pack_start(GTK_BOX(hbox),vbox,FALSE,FALSE,0);
gtk_table_attach(GTK_TABLE(table),hbox,f%10,f%10+1,f/10,f/10+1,GTK_SHRINK,GTK_SHRINK,0,0);
        }
        gtk_notebook_append_page(GTK_NOTEBOOK(nb), table ,NULL);
     }

     gtk_widget_show_all(wnd);
     return 0;
 }

 int main(int argc, char *argv[])
 {
        gtk_init(&argc,&argv);
        createWindow();
        gtk_main();
        return 0;
 }


Owen Taylor wrote:
On Mon, 2003-06-09 at 03:43, Petr Pytelka wrote:

Hi,

I've wrote simple testing application 10pages x 100 GtkEntry on each page. When I switched from one page to another it is very slow (I can see redrawing of controls) - takes ca. 400 ms.

I was debugging the problem and it looks like that the GtkNotebook isn't written the most optimal. Have you anyone investigating the problem ? Do you think that it is possible to improve the performance ? Any ideas or tips ?


Can you attach your test case? Offhand, I would not expect slowness
to be related to the implementation of GtkNotebook.

1000 widgets is a lot ... things aren't going to be especially fast
with that many widgets in any case.

Regards,
                                            Owen






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