forked from qt-creator/qt-creator
Clang: Reduce database accesses
If we prefetch data from the database to the caches we reduce the database transaction calls which are quite expensive. Change-Id: I617a0d886807402e0a94291a913a77f989970b55 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -81,6 +81,7 @@ void RefactoringServer::requestSourceRangesForQueryMessage(RequestSourceRangesFo
|
||||
|
||||
void RefactoringServer::updateProjectParts(UpdateProjectPartsMessage &&message)
|
||||
{
|
||||
m_filePathCache.populateIfEmpty();
|
||||
m_symbolIndexing.updateProjectParts(message.takeProjectsParts());
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
, m_database(database)
|
||||
{}
|
||||
|
||||
void addOrUpdateTasks(std::vector<SymbolIndexerTask> &&tasks)
|
||||
void addOrUpdateTasks(std::vector<SymbolIndexerTask> &&tasks) override
|
||||
{
|
||||
auto merge = [] (SymbolIndexerTask &&first, SymbolIndexerTask &&second) {
|
||||
first.callable = std::move(second.callable);
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
m_progressCounter.addTotal(int(m_tasks.size() - oldSize));
|
||||
}
|
||||
void removeTasks(const std::vector<int> &projectPartIds)
|
||||
void removeTasks(const ProjectPartIds &projectPartIds) override
|
||||
{
|
||||
auto shouldBeRemoved = [&] (const SymbolIndexerTask& task) {
|
||||
return std::binary_search(projectPartIds.begin(), projectPartIds.end(), task.projectPartId);
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
return m_tasks;
|
||||
}
|
||||
|
||||
void processEntries()
|
||||
void processEntries() override
|
||||
{
|
||||
auto slotUsage = m_symbolIndexerScheduler.slotUsage();
|
||||
uint taskCount = slotUsage.free;
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <queueinterface.h>
|
||||
|
||||
#include <projectpartid.h>
|
||||
|
||||
#include <utils/smallstringvector.h>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
@@ -38,8 +40,8 @@ class SymbolIndexerTaskQueueInterface : public QueueInterface
|
||||
public:
|
||||
virtual void addOrUpdateTasks(std::vector<SymbolIndexerTask> &&tasks) = 0
|
||||
/* [[expects: std::is_sorted(tasks)]] */;
|
||||
virtual void removeTasks(const std::vector<int> &projectPartIds) = 0
|
||||
/* [[expects: std::is_sorted(projectPartIds)]] */;
|
||||
virtual void removeTasks(const ProjectPartIds &projectPartIds) = 0
|
||||
/* [[expects: std::is_sorted(projectPartIds)]] */;
|
||||
|
||||
protected:
|
||||
~SymbolIndexerTaskQueueInterface() = default;
|
||||
|
||||
Reference in New Issue
Block a user