ProjectTree: Improve performance of finding nodes

Using projectNode->forEachGenericNode(...) to find a node is much slower
than using project->nodeForFilePath(...), since the latter uses a binary
search.

Fixes: QTCREATORBUG-25845
Change-Id: I91be577a11b03915d1f21fe86a4cdd9ab0381f51
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2021-07-13 16:58:02 +02:00
parent 098e616512
commit 426f8185c2
3 changed files with 10 additions and 11 deletions

View File

@@ -851,7 +851,7 @@ bool Project::isKnownFile(const Utils::FilePath &filename) const
}
const Node *Project::nodeForFilePath(const Utils::FilePath &filePath,
const Project::NodeMatcher &extraMatcher)
const Project::NodeMatcher &extraMatcher) const
{
const FileNode dummy(filePath, FileType::Unknown);
const auto range = std::equal_range(d->m_sortedNodeList.cbegin(), d->m_sortedNodeList.cend(),