src: Improved code view performance
* fixed slow annotation hovering * improved retrieving source locations for whole files
This commit is contained in:
@@ -1299,26 +1299,26 @@ std::shared_ptr<SourceLocationCollection> PersistentStorage::getSourceLocationsF
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::vector<Id> fileIds;
|
||||
std::vector<FilePath> filePaths;
|
||||
std::vector<Id> nonFileIds;
|
||||
|
||||
for (const Id tokenId : tokenIds)
|
||||
{
|
||||
if (getFileNodePath(tokenId).empty())
|
||||
FilePath path = getFileNodePath(tokenId);
|
||||
if (path.empty())
|
||||
{
|
||||
nonFileIds.push_back(tokenId);
|
||||
}
|
||||
else
|
||||
{
|
||||
fileIds.push_back(tokenId);
|
||||
filePaths.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceLocationCollection> collection = std::make_shared<SourceLocationCollection>();
|
||||
|
||||
for (const StorageFile& file : m_sqliteIndexStorage.getAllByIds<StorageFile>(fileIds))
|
||||
for (const FilePath& path : filePaths)
|
||||
{
|
||||
collection->addSourceLocationFile(m_sqliteIndexStorage.getSourceLocationsForFile(FilePath(file.filePath)));
|
||||
collection->addSourceLocationFile(std::make_shared<SourceLocationFile>(path, true, false));
|
||||
}
|
||||
|
||||
if (nonFileIds.size())
|
||||
|
||||
@@ -793,7 +793,7 @@ std::vector<std::pair<int, SqliteDatabaseIndex>> SqliteIndexStorage::getIndices(
|
||||
SqliteDatabaseIndex("occurrence_element_id_index", "occurrence(element_id)")
|
||||
));
|
||||
indices.push_back(std::make_pair(
|
||||
STORAGE_MODE_CLEAR,
|
||||
STORAGE_MODE_READ | STORAGE_MODE_CLEAR,
|
||||
SqliteDatabaseIndex("occurrence_source_location_id_index", "occurrence(source_location_id)")
|
||||
));
|
||||
indices.push_back(std::make_pair(
|
||||
|
||||
@@ -93,9 +93,18 @@ namespace utility
|
||||
template<typename T>
|
||||
bool shareElement(const std::set<T>& a, const std::set<T>& b)
|
||||
{
|
||||
std::set<T> c(a.begin(), a.end());
|
||||
c.insert(b.begin(), b.end());
|
||||
return a.size() + b.size() != c.size();
|
||||
const std::set<T>* aPtr = a.size() > b.size() ? &a : &b;
|
||||
const std::set<T>* bPtr = aPtr == &a ? &b : &a;
|
||||
|
||||
for (const T& bt : *bPtr)
|
||||
{
|
||||
if (aPtr->find(bt) != aPtr->end())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ApplicationArchitectureType getApplicationArchitectureType();
|
||||
|
||||
Reference in New Issue
Block a user