@b4n 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).

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().

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.

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.

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/797#issuecomment-169034160

Reply via email to