From d2b41f7598b7b21944c81f28f2dbb1609833fe44 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 28 May 2019 17:40:35 +0200 Subject: [PATCH] logic: improved python post processing speed and show progress dialog --- src/lib/data/indexer/TaskExecuteCustomCommands.cpp | 3 ++- src/lib/data/indexer/TaskExecuteCustomCommands.h | 2 +- src/lib/data/storage/PersistentStorage.cpp | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lib/data/indexer/TaskExecuteCustomCommands.cpp b/src/lib/data/indexer/TaskExecuteCustomCommands.cpp index f447c3bb..d4c68037 100644 --- a/src/lib/data/indexer/TaskExecuteCustomCommands.cpp +++ b/src/lib/data/indexer/TaskExecuteCustomCommands.cpp @@ -69,7 +69,7 @@ void TaskExecuteCustomCommands::doEnter(std::shared_ptr blackboard) } } // reverse because we pull elements from the back of these vectors - std::reverse(m_parallelCommands.begin(), m_parallelCommands.end()); + std::reverse(m_parallelCommands.begin(), m_parallelCommands.end()); std::reverse(m_serialCommands.begin(), m_serialCommands.end()); } } @@ -255,6 +255,7 @@ void TaskExecuteCustomCommands::runIndexerCommand(std::shared_ptrshowUnknownProgressDialog(L"Finish Indexing", L"Run Python Post Processing"); std::vector unsolvedLocationIds; for (const StorageSourceLocation location : storage.getStorageSourceLocations()) diff --git a/src/lib/data/indexer/TaskExecuteCustomCommands.h b/src/lib/data/indexer/TaskExecuteCustomCommands.h index 9d4ed08f..2cf1bab4 100644 --- a/src/lib/data/indexer/TaskExecuteCustomCommands.h +++ b/src/lib/data/indexer/TaskExecuteCustomCommands.h @@ -37,7 +37,7 @@ private: void executeParallelIndexerCommands(int threadId, std::shared_ptr blackboard); void runIndexerCommand(std::shared_ptr indexerCommand, std::shared_ptr blackboard); - static void runPythonPostProcessing(PersistentStorage& storage); + void runPythonPostProcessing(PersistentStorage& storage); private: std::unique_ptr m_indexerCommandProvider; diff --git a/src/lib/data/storage/PersistentStorage.cpp b/src/lib/data/storage/PersistentStorage.cpp index e7120dcc..e8786133 100644 --- a/src/lib/data/storage/PersistentStorage.cpp +++ b/src/lib/data/storage/PersistentStorage.cpp @@ -1473,14 +1473,14 @@ std::shared_ptr PersistentStorage::getSourceLocationsF std::shared_ptr collection = std::make_shared(); + std::map> m_locationIdToElementIds; + for (const StorageOccurrence& occurrence: m_sqliteIndexStorage.getOccurrencesForLocationIds(locationIds)) + { + m_locationIdToElementIds[occurrence.sourceLocationId].push_back(occurrence.elementId); + } + for (StorageSourceLocation location: m_sqliteIndexStorage.getAllByIds(locationIds)) { - std::vector elementIds; - for (const StorageOccurrence& occurrence: m_sqliteIndexStorage.getOccurrencesForLocationId(location.id)) - { - elementIds.push_back(occurrence.elementId); - } - const LocationType type = intToLocationType(location.type); if (type != LOCATION_TOKEN && type != LOCATION_SCOPE && type != LOCATION_LOCAL_SYMBOL && type != LOCATION_UNSOLVED) { @@ -1490,7 +1490,7 @@ std::shared_ptr PersistentStorage::getSourceLocationsF collection->addSourceLocation( intToLocationType(location.type), location.id, - elementIds, + m_locationIdToElementIds[location.id], getFileNodePath(location.fileNodeId), location.startLine, location.startCol,