ClangPchManager: Optimize difference computing

Don't create temporary containers.

Change-Id: I28e8999c3443a20c8ef6da3a048ec90fbb99a3c3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2019-08-05 14:18:01 +02:00
parent d610cf3793
commit 912b4763e0

View File

@@ -189,21 +189,20 @@ ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDep
const auto &newSources = buildDependency.sources; const auto &newSources = buildDependency.sources;
SourceEntries updatedSourceTyes; Change change = Change::No;
updatedSourceTyes.reserve(newSources.size());
std::set_symmetric_difference(newSources.begin(), std::set_symmetric_difference(newSources.begin(),
newSources.end(), newSources.end(),
oldSources.begin(), oldSources.begin(),
oldSources.end(), oldSources.end(),
std::back_inserter(updatedSourceTyes), make_iterator([&](SourceEntry entry) {
change = changedSourceType(entry, change);
}),
[](SourceEntry first, SourceEntry second) { [](SourceEntry first, SourceEntry second) {
return std::tie(first.sourceId, first.sourceType) return std::tie(first.sourceId, first.sourceType)
< std::tie(second.sourceId, second.sourceType); < std::tie(second.sourceId, second.sourceType);
}); });
auto change = changedSourceType(updatedSourceTyes);
switch (change) { switch (change) {
case Change::Project: case Change::Project:
updateProjectProjectParts.emplace_back(std::move(projectPart)); updateProjectProjectParts.emplace_back(std::move(projectPart));
@@ -218,9 +217,6 @@ ProjectPartsManagerInterface::UpToDataProjectParts ProjectPartsManager::checkDep
} }
if (change == Change::No) { if (change == Change::No) {
SourceEntries updatedTimeStamps;
updatedTimeStamps.reserve(newSources.size());
Change change = mismatch_collect( Change change = mismatch_collect(
newSources.begin(), newSources.begin(),
newSources.end(), newSources.end(),