From: Daniel Carl Date: Sun, 3 Feb 2013 20:31:52 +0000 (+0100) Subject: Little performance improvement for completions. X-Git-Url: https://git.owens.tech/git.owens.tech/git.owens.tech/git?a=commitdiff_plain;h=4a0f51865f8f7457d7030930aa6ed15a2f421b4e;p=vimb.git Little performance improvement for completions. --- diff --git a/src/completion.c b/src/completion.c index 26f4984..7ebdb1c 100644 --- a/src/completion.c +++ b/src/completion.c @@ -131,9 +131,12 @@ static GList* completion_init_completion(GList* target, GList* source, const gch if (match) { Completion* c = completion_get_new(data, prefix); gtk_box_pack_start(GTK_BOX(vp.gui.compbox), c->event, TRUE, TRUE, 0); - target = g_list_append(target, c); + /* use prepend because that faster */ + target = g_list_prepend(target, c); } } + + target = g_list_reverse(target); g_strfreev(token); return target; @@ -245,6 +248,7 @@ static void completion_set_color(Completion* completion, const VpColor* fg, cons { VP_WIDGET_OVERRIDE_COLOR(completion->label, GTK_STATE_NORMAL, fg); VP_WIDGET_OVERRIDE_BACKGROUND(completion->event, GTK_STATE_NORMAL, bg); + /* TODO is it really necessary to set the font for each item */ VP_WIDGET_OVERRIDE_FONT(completion->label, font); }