GNOME Bugzilla – Bug 729832
Creating new note is very slow (patch attached)
Last modified: 2014-05-11 16:31:56 UTC
Created attachment 276195 [details] [review] Patch to use ustring iterator in TrieTree::find_matches() When creating a new note with the "Automatically link to notes" option selected, gnote hangs for a few minutes with 100% CPU usage before popping up the new note window. I have quite a few large notes. I compiled git master with debugging and caught it looping in TrieTree::find_matches() with the following stack:
+ Trace 233576
The TrieTree::find_matches() function appears to be looking up characters in the UTF-8 text one at a time, which means rescanning from the beginning of the string each time (since you can't randomly access characters in UTF-8). Attached is a patch to use a ustring iterator instead, which improves the note creation time to essentially instant in my case.
Good catch. Totally make sense. It happen that "add_keyword" has the same issue.
Nice catch. Committed.