logic: Improved code view performance

* fixed bottleneck in TokenLocationCollection::findLocationFile()
* cache file ids and paths in PersistenStorage
This commit is contained in:
Eberhard Graether
2016-05-12 22:50:14 +02:00
parent 6a576bccc9
commit 245cafdc7b
5 changed files with 58 additions and 81 deletions
@@ -101,14 +101,7 @@ TokenLocation* TokenLocationCollection::findTokenLocationById(Id id) const
TokenLocationFile* TokenLocationCollection::findTokenLocationFileByPath(const FilePath& filePath) const
{
std::map<FilePath, std::shared_ptr<TokenLocationFile>>::const_iterator it =
find_if(m_files.begin(), m_files.end(),
[&](const std::pair<FilePath, std::shared_ptr<TokenLocationFile>>& p)
{
return p.first == filePath;
}
);
std::map<FilePath, std::shared_ptr<TokenLocationFile>>::const_iterator it = m_files.find(filePath);
if (it != m_files.end())
{
return it->second.get();