GNOME Bugzilla – Bug 575873
gail kills performance adding items to tree model
Last modified: 2011-01-20 10:47:41 UTC
When the modules libgail and libatk-bridge are loaded the performances for adding items to a model is really bad. For example, this becames super slow: for (i = 0; i < 2000; i++) { gtk_list_store_append (GTK_LIST_STORE (model), &iter); } > 25sec on my machines, without the modules the time is ~0. This only happens on new version of GTK+GAIL, as in Fedora 9 and 10, Ubuntu 8.04 and 8.10, etc. I tested with GTK 2.12 and gail 1.22. From what I can tell: 1. gtk_list_store_insert sends signal "model::row_inserted" (gtktreemodel.c) 2. gailtreeview.c#model_row_inserted sends signal atk_obj::"row_inserted" sends signal atk_obj::"children_changed::add" -> I believe the problem is here. row_inserted is sent to every row, even the one that are not visible, (not in the client area). children_changed::add is sent to all cells, even the ones that are not visible, outside the client area (to the right, or to the left). 3. bridge.c#spi_atk_bridge_signal_listener calls atk_object_ref_accessible_child 4. gail_tree_view_ref_child calls gtk_tree_view_column_cell_set_cell_data (gailtreeview.c) This takes a very long time to finish.
Created attachment 130917 [details] testcase Try this test case with gail loaded and without, this what I get on my machine: -sh-3.1$ gcc -o t `pkg-config --cflags --libs gtk+-2.0` pr240033-simple.c -sh-3.1$ export GTK_MODULES=/usr/local/gtk-2.12.1/lib/gtk-2.0/modules/libgail:/usr/local/gtk-2.12.1/lib/gtk-2.0/modules/libatk-bridge -sh-3.1$ ./t Start End time elapsed 25.835674000 (seconds) -sh-3.1$ export GTK_MODULES= -sh-3.1$ ./t Start End time elapsed 0.014027000 (seconds) Note: this problem is very bad for Eclipse, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=240033
For me, with no modules, it's around 0.03 seconds, with those two modules it varies between .05 and .16. These numbers are too small to really be meaningful. Maybe you can repeat them 100 times to reduce the noise?
You might try disconnecting the model before changing it. See bug #547774. Hope this helps.
(In reply to comment #2) > For me, with no modules, it's around 0.03 seconds, with those two modules it > varies between .05 and .16. Are you sure the modules are being loaded ? Note the path to GTK_MODULES in comment #1 is specific to my machine. Usually it is GTK_MODULES=/usr/lib/gtk-2.0/modules/libgail:/usr/lib/gtk-2.0/modules/libatk-bridge If that doesn't do it, try to enable assistive technologies (on gnome, system->preferences->assistive technologies). Log off, and log back in.
(In reply to comment #4) > (In reply to comment #2) > > For me, with no modules, it's around 0.03 seconds, with those two modules it > > varies between .05 and .16. > > Are you sure the modules are being loaded ? > Note the path to GTK_MODULES in comment #1 is specific to my machine. Usually > it is > GTK_MODULES=/usr/lib/gtk-2.0/modules/libgail:/usr/lib/gtk-2.0/modules/libatk-bridge I know how to load GTK+ modules. And the fact that the timing I get is consistently different (higher, with a much wider variance), it means *something* was changed, and I believe it was the modules being loaded successfully. > If that doesn't do it, try to enable assistive technologies (on gnome, > system->preferences->assistive technologies). Log off, and log back in. Last time I did that I regret it for the next six months :(.
(In reply to comment #3) > You might try disconnecting the model before changing it. See bug #547774. > Hope this helps. It gets fast if I do that, but it creates problems to: lose the selection, lose the scroll position, lose the expand state of items, etc (who knows). I tried blocking row_inserted but that also stopped the tree_view handlers from running... (I only wanted the gail handler not to run).
I got a new Linux installed, Fedora 10. Very easy to see the problem: 1. gcc -o t `pkg-config --cflags --libs gtk+-2.0` pr240033-simple.c 2. export GTK_MODULES=gail:atk-bridge 3. /usr/libexec/at-spi-registryd & 4. ./t 5. click on the test button and wait... >30s on my machine If you enable assistive technologies you don't need step 3. I also downloaded the latest version of all libraries: [felipe@wsfheidrichlnx gtk]$ ls /usr/local/src/gtk-2.16.0/ -l total 26144 drwxrwxrwx 6 65535 bin 4096 2009-03-24 16:32 atk-1.26.0 drwxrwxrwx 12 1000 1000 4096 2009-03-24 17:10 at-spi-1.26.0 drwxrwxrwx 7 1000 1000 4096 2008-06-30 02:36 gail-1.22.3 drwxrwxrwx 12 500 500 4096 2009-03-24 16:20 glib-2.20.0 drwxrwxrwx 15 500 500 4096 2009-03-24 16:56 gtk+-2.16.0 drwxrwxrwx 9 500 500 4096 2009-03-24 16:27 pango-1.24.0 Compiled and linked my testcase against it but the problem is still present.
*** This bug has been marked as a duplicate of bug 577098 ***