From d1a5ceac424158218d585f8a34e527a537c17e5e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Techet?= Date: Sat, 13 Feb 2016 02:00:30 +0100 Subject: [PATCH] Don't pass multiple copies of identical type name to scintilla for colorization For instance for the boost library this makes the resulting string passed to scintilla 6x shorter. Because scintilla goes through this list more or less linearly for every single word in the document, this can bring significant reductions of time spent when recolorizing. --- src/symbols.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/symbols.c b/src/symbols.c index 045914694..5268a055c 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -287,17 +287,21 @@ GString *symbols_find_typenames_as_string(gint lang, gboolean global) if ((typedefs) && (typedefs->len > 0)) { + const gchar *last_name = ""; + s = g_string_sized_new(typedefs->len * 10); for (j = 0; j < typedefs->len; ++j) { tag = TM_TAG(typedefs->pdata[j]); tag_lang = tag->lang; - if (tag->name && tm_tag_langs_compatible(lang, tag_lang)) + if (tag->name && tm_tag_langs_compatible(lang, tag_lang) && + strcmp(tag->name, last_name) != 0) { if (j != 0) g_string_append_c(s, ' '); g_string_append(s, tag->name); + last_name = tag->name; } } } -- 2.11.4.GIT