<p></p>
<p><b>@techee</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/3185#discussion_r863211941">src/tagmanager/tm_workspace.c</a>:</p>
<pre style='color:#555'>> +            !(tag->type & tm_tag_local_var_t) &&
+               is_autocomplete_tag(tag, info);
+}
+
+
+static guint copy_tags(GPtrArray *dst, TMTag **src, guint src_len, GHashTable *name_table,
+       gint num, gboolean (*predicate) (TMTag *, CopyInfo *), CopyInfo *info)
+{
+       guint i;
+
+       g_return_val_if_fail(src && dst, 0);
+
+       for (i = 0; i < src_len && num > 0; i++)
+       {
+               TMTag *tag = *src;
+               if (predicate(tag, info) &&
</pre>
<blockquote>
<p dir="auto">Regardless of the order, IMO the call to is_autocomplete_tag() doesn't need to be duplicated in each predicate function but can be called in one place here, especially if the compiler whats to inline it.</p>
</blockquote>
<p dir="auto">Agree.</p>
<p dir="auto">And if performance is your concern, we can actually do better. I didn't think of it when writing the patch but these calls</p>
<pre class="notranslate"><code class="notranslate">             copy_tags(dst, found, count, name_table, max_num - dst->len, is_local_tag, info);
                copy_tags(dst, found, count, name_table, max_num - dst->len, is_current_file_tag, info);
                copy_tags(dst, found, count, name_table, max_num - dst->len, is_header_file_tag, info);
</code></pre>
<p dir="auto">could be modified not to perform on the workspace tags but only the tags from the current file or the current header (that is, from <code class="notranslate">info->file->tags_array</code> or <code class="notranslate">info->header->tags_array</code> (of course after performing tm_tags_find() on them before). That should speed up the search for local tags, current file's tags and header (and possibly include) tags significantly.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/3185#discussion_r863211941">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ6Q23H6UTCMO6P6FW3VIBEALANCNFSM5UWGU33A">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAIOWJ4HJHMOAFED3QA2YXDVIBEALA5CNFSM5UWGU33KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOHEZEECA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><geany/geany/pull/3185/review/959595016</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/3185#discussion_r863211941",
"url": "https://github.com/geany/geany/pull/3185#discussion_r863211941",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>