<p><a href="https://github.com/b4n" class="user-mention">@b4n</a> Thanks for reviewing and for the patch - yes, the tree lookup was unnecessary (I was first simplifying the existing code to understand it better and with the original code the TMTag parameter was unnecessary so I replaced it just with gchar *name, then changed the code to use the tree but forgot we can actually use the original tag).</p>

<p>About the g_tree_search() and g_tree_lookup() pairs - yes, if there's at least a single element in the tree, it will be returned by g_tree_search()'s user_data. The only "danger" is when the tree is empty (can happen because of tags_table_remove()) but there's no real problem here either as looking for whatever line number always returns NULL in g_tree_lookup().</p>

<p>Yes, the patch won't do any miracles - a big enough file will make the editor unusable but at least the slow-downs will be kind of "normal" - N*log(N) is "almost" like N, for big enough N the log(N) part gets smaller and smaller. Anything quadratic is fine until some number but then becomes crazy within a very short interval.</p>

<p>By the way, is there a way to apply patches using spaces instead of tabs? Github seems to replace tabs with spaces and I had to apply your changes manually because of that.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/geany/geany/pull/797#issuecomment-169034160">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ_9BK1-Zv5lKUIXtRyPleAil_wuEks5pW9gBgaJpZM4G0Ju3.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/pull/797#issuecomment-169034160"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>