[geany/geany] 44fec8: Prepend values to GtkTreeStore to eliminate quadratic complexity

Jiří Techet git-noreply at xxxxx
Sun May 3 17:36:26 UTC 2015


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sun, 03 May 2015 17:36:26 UTC
Commit:      44fec8f7518d63eeb4e1a784ec7fe465d0002270
             https://github.com/geany/geany/commit/44fec8f7518d63eeb4e1a784ec7fe465d0002270

Log Message:
-----------
Prepend values to GtkTreeStore to eliminate quadratic complexity

The tree model nodes consist of GNode structs:

struct GNode {
  gpointer data;
  GNode	  *next;
  GNode	  *prev;
  GNode	  *parent;
  GNode	  *children;
};

where children are a linked list. To append a value, the list has to be
walked to the end and with nodes with many children (which is our case)
this becomes very expensive.

We sort the tree afterwards anyway so it doesn't matter where we insert the
value.


Modified Paths:
--------------
    src/symbols.c

Modified: src/symbols.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1523,7 +1523,7 @@ static void update_tree_tags(GeanyDocument *doc, GList **tags)
 			/* insert the new element */
 			name = get_symbol_name(doc, tag, parent_name != NULL);
 			tooltip = get_symbol_tooltip(doc, tag);
-			gtk_tree_store_insert_with_values(store, &iter, parent, -1,
+			gtk_tree_store_insert_with_values(store, &iter, parent, 0,
 					SYMBOLS_COLUMN_NAME, name,
 					SYMBOLS_COLUMN_TOOLTIP, tooltip,
 					SYMBOLS_COLUMN_ICON, icon,



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list