From 44fec8f7518d63eeb4e1a784ec7fe465d0002270 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Techet?= Date: Sun, 3 May 2015 11:34:30 +0200 Subject: [PATCH] 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. --- src/symbols.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/symbols.c b/src/symbols.c index 29cea9ee2..f223b9ba0 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -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, -- 2.11.4.GIT