[geany/geany] d1a5ce: Don't pass multiple copies of identical type name to scintilla for colorization

Jiří Techet git-noreply at xxxxx
Fri Feb 26 00:10:00 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Fri, 26 Feb 2016 00:10:00 UTC
Commit:      d1a5ceac424158218d585f8a34e527a537c17e5e
             https://github.com/geany/geany/commit/d1a5ceac424158218d585f8a34e527a537c17e5e

Log Message:
-----------
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.


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

Modified: src/symbols.c
6 lines changed, 5 insertions(+), 1 deletions(-)
===================================================================
@@ -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;
 			}
 		}
 	}



--------------
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