Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Thu, 30 Oct 2014 21:08:17 UTC
Commit: 32a3dfab7f6e75f102a2cac79c6ce3eac7c2a216
https://github.com/geany/geany/commit/32a3dfab7f6e75f102a2cac79c6ce3eac7c2a…
Log Message:
-----------
Use binary search when removing file tags
Even though the binary search requires expensive string comparisons,
there are just log(n) of them to find the tag in the workspace array
and the result is much faster than scanning the array linearly (this
of course works only under the condition that
len(source_file->tags_array) << len(workspace_array)
This is however satisfied for big projects (and doesn't matter for small
projects).
Also make the tm_tags_find() function more user friendly by returning
tagCount 0 when no tags found.
Modified Paths:
--------------
tagmanager/src/tm_tag.c
Modified: tagmanager/src/tm_tag.c
32 lines changed, 28 insertions(+), 4 deletions(-)
===================================================================
@@ -809,13 +809,36 @@ gboolean tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes,
void tm_tags_remove_file_tags(TMSourceFile *source_file, GPtrArray *tags_array)
{
guint i;
- for (i = 0; i < tags_array->len; i++)
+ GPtrArray *to_delete = g_ptr_array_sized_new(source_file->tags_array->len);
+
+ for (i = 0; i < source_file->tags_array->len; i++)
{
- TMTag *tag = tags_array->pdata[i];
+ guint j;
+ gint tag_count;
+ TMTag **found;
+ TMTag *tag = source_file->tags_array->pdata[i];
+
+ found = tm_tags_find(tags_array, tag->name, FALSE, TRUE, &tag_count);
- if (tag != NULL && tag->file == source_file)
- tags_array->pdata[i] = NULL;
+ for (j = 0; j < tag_count; j++)
+ {
+ if (*found != NULL && (*found)->file == source_file)
+ {
+ /* we cannot set the pointer to NULL now because the search wouldn't work */
+ g_ptr_array_add(to_delete, found);
+ break;
+ }
+ found++;
+ }
}
+
+ for (i = 0; i < to_delete->len; i++)
+ {
+ TMTag **tag = to_delete->pdata[i];
+ *tag = NULL;
+ }
+ g_ptr_array_free(to_delete, TRUE);
+
tm_tags_prune(tags_array);
}
@@ -1055,6 +1078,7 @@ TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name,
int tagMatches=0;
TMSortOptions sort_options;
+ *tagCount = 0;
if ((!tags_array) || (!tags_array->len))
return NULL;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Thu, 30 Oct 2014 21:08:17 UTC
Commit: cb9e4bbf7446e45365cad2242087f2a766662f20
https://github.com/geany/geany/commit/cb9e4bbf7446e45365cad2242087f2a766662…
Log Message:
-----------
Microoptimization in merge
Improves performance by about 10%.
Modified Paths:
--------------
tagmanager/src/tm_tag.c
Modified: tagmanager/src/tm_tag.c
4 lines changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -899,7 +899,9 @@ static GPtrArray *merge(GPtrArray *big_array, GPtrArray *small_array,
while (i1 <= j1)
{
val1 = big_array->pdata[i1];
- g_ptr_array_add(res_array, val1);
+ /* we allocated enough space so we are sure we don't need to reallocate
+ * the array - copy and increment the size directly so it can be inlined */
+ res_array->pdata[res_array->len++] = val1;
i1++;
}
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 26 Oct 2014 22:44:19 UTC
Commit: a7a893a22f15078d498ea6c61ba0a3c79aa8b85b
https://github.com/geany/geany/commit/a7a893a22f15078d498ea6c61ba0a3c79aa8b…
Log Message:
-----------
Set -O2 compiler flag by default for gcc
But only if no other optimization flags could be found.
Modified Paths:
--------------
wscript
Modified: wscript
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -302,6 +302,8 @@ but you then may not have a local copy of the HTML manual.'''
# some more compiler flags
conf.env.append_value('CFLAGS', ['-DHAVE_CONFIG_H'])
+ if conf.env['CC_NAME'] == 'gcc' and '-O' not in ''.join(conf.env['CFLAGS']):
+ conf.env.append_value('CFLAGS', ['-O2'])
if revision is not None:
conf.env.append_value('CFLAGS', ['-g', '-DGEANY_DEBUG'])
# Scintilla flags
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).