After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 430095 - Improving the performance of GtkTreeView by reducing the number of unnecessary walking of lists
Improving the performance of GtkTreeView by reducing the number of unnecessar...
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2007-04-15 20:31 UTC by Markku Vire
Modified: 2018-04-15 00:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to reduce unneeded usage of lists in treemodels (21.76 KB, patch)
2007-04-15 20:37 UTC, Markku Vire
needs-work Details | Review
Modified patch that fixes a NULL pointer reference (21.96 KB, patch)
2007-04-26 20:34 UTC, Markku Vire
needs-work Details | Review
Updated the patch (25.96 KB, patch)
2007-11-11 13:18 UTC, Markku Vire
none Details | Review

Description Markku Vire 2007-04-15 20:31:27 UTC
Recently there was discussion on gtk-devel-list about GtkTreeView performance (starting from here: http://mail.gnome.org/archives/gtk-devel-list/2007-March/msg00231.html). It was pointed out that there are several places where lists are used needlessly. 

 * Keeping column types in linked list is a waste, but an array would 
   do much better.
 * Sort function is looked up by walking a list before each compare 
   function call, even though this information could be cached while 
   changing the sort column.

This bug is opened in order to organize the patches related to this matter.
Comment 1 Markku Vire 2007-04-15 20:37:14 UTC
Created attachment 86395 [details] [review]
Patch to reduce unneeded usage of lists in treemodels

This is otherwise the same patch that I sent to gtk-devel-list earlier, but it also contains a version of caching GtkTreeDataSortHeader.
Comment 2 Matthias Clasen 2007-04-26 06:43:58 UTC
Something is not quite right with the patch:

testtreeview segfaults, with the following stacktrace:

Program received signal SIGSEGV, Segmentation fault.

Thread NaN (LWP 20370)

  • #0 _gtk_tree_data_list_free
    at gtktreedatalist.c line 44
  • #1 IA__gtk_list_store_remove
    at gtkliststore.c line 816
  • #2 main
    at testtreeview.c line 1384

Comment 3 Markku Vire 2007-04-26 20:34:59 UTC
Created attachment 87096 [details] [review]
Modified patch that fixes a NULL pointer reference

Yeah, my bad :( 

I didn't detect that _gtk_tree_data_list_free was actually called with NULL argument. Now testtreeview runs nicely.
Comment 4 Matthias Clasen 2007-04-27 19:54:44 UTC
Hmm, testtreeview is fixed, but testtreemodel still segfaults here:

  • #0 __kernel_vsyscall
  • #1 raise
    from /lib/libc.so.6
  • #2 abort
    from /lib/libc.so.6
  • #3 __libc_message
    from /lib/libc.so.6
  • #4 _int_free
    from /lib/libc.so.6
  • #5 free
    from /lib/libc.so.6
  • #6 IA__g_free
    at gmem.c line 187
  • #7 IA__g_slice_free1
    at gslice.c line 855
  • #8 _gtk_tree_data_list_free
    at gtktreedatalist.c line 57
  • #9 IA__g_sequence_foreach_range
    at gsequence.c line 247
  • #10 IA__g_sequence_foreach
    at gsequence.c line 278
  • #11 gtk_list_store_finalize


Also there are some minor indentation and whitespace issues in the
patch, like missing spaces before '('.
Comment 5 Markku Vire 2007-11-10 19:51:26 UTC
The changed function signature of my _gtk_tree_data_list_free caused this one. I needed to introduce a helper function to use with g_sequence_foreach. I'll go trough the patch for formatting changes...
Comment 6 Markku Vire 2007-11-11 13:18:48 UTC
Created attachment 98911 [details] [review]
Updated the patch

 * Fixed the crash when finalizing a GtkListStore (wrong function signature).
 * Implemented sort_header caching for GtkTreeStore.
     I changed unused "last" member from GtkTreeStore structure
     to hold this information. Nobody was using it currently and
     it should be treated as private data. I wonder if a 
     change like this is a problem?
 * Reviewed the coding style
Comment 7 Matthias Clasen 2015-03-08 15:27:29 UTC
still a potentially valid (micro-)optimization
Comment 8 Matthias Clasen 2018-02-10 05:27:03 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 9 Matthias Clasen 2018-04-15 00:38:45 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new