CppEditor: Reuse document for search results

Instead of open a document for every entry we do open it only once per
search. For that we sort the entries by file path, so that they are clustered
together and reuse the last document if the path hasn't changed. This can
improve the calculations of the search results drastically.

Change-Id: I9c9c1e387624297d84c6a2ca6edb6130f739d295
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Marco Bubke
2019-08-21 14:33:13 +02:00
committed by Tim Jenssen
parent 246277c570
commit 20a304c8e0
2 changed files with 54 additions and 19 deletions

View File

@@ -51,6 +51,12 @@ public:
&& first.path == second.path;
}
friend bool operator<(const Usage &first, const Usage &second)
{
return std::tie(first.path, first.line, first.column)
< std::tie(second.path, second.line, second.column);
}
public:
QString path;
int line = 0;