Kaydet (Commit) 44fec8f7 authored tarafından Jiří Techet's avatar Jiří Techet

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.
üst 8ffd687a
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment