Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 07 Feb 2016 03:35:36 UTC Commit: de60a4c48a36fb8a080e981a5b6917141c2863b7 https://github.com/geany/geany-plugins/commit/de60a4c48a36fb8a080e981a5b6917...
Log Message: ----------- debugger/gdb_mi: Improve implementation of parse_string()
Simply copy the whole block at once instead of populating a buffer byte by byte.
This gives a speedup of about 12% on typical data.
Modified Paths: -------------- debugger/src/gdb_mi.c
Modified: debugger/src/gdb_mi.c 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -182,15 +182,15 @@ static gchar *parse_cstring(const gchar **p) * the docs aren't clear on this */ static gchar *parse_string(const gchar **p) { - GString *str = g_string_new(NULL); + const gchar *base = *p;
if (g_ascii_isalpha(**p) || strchr("-_.", **p)) { - g_string_append_c(str, **p); for ((*p)++; g_ascii_isalnum(**p) || strchr("-_.", **p); (*p)++) - g_string_append_c(str, **p); + ; } - return g_string_free(str, FALSE); + + return g_strndup (base, *p - base); }
/* parses: string "=" value */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).