diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-12-22 13:40:19 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2016-12-22 17:10:47 +0000 |
commit | 5a8d76c2f6006ff70bcc78853dbe95b6465851a8 (patch) | |
tree | 1f57894437450c7b81682e49d028f0b6f81da597 /src/lib | |
parent | 519d065e008e75589f6ce440d840f4114c22b275 (diff) |
Do not remove artifacts from the scan result cache
Presumably, this code was to ensure that only finished artifacts would
be retrieved from the cache. However, we can simply make sure that sure
unbuilt artifacts do not end up there in the first place.
Benchmarker output is below. Real-world numbers: When building the Qt
Creator super project, the total number of scanned header files goes
down from 24966 to 17889.
========== Performance data for Rule Execution ==========
Old instruction count: 3560941434
New instruction count: 3399056106
Relative change: -5 %
Old peak memory usage: 17590920 Bytes
New peak memory usage: 17668328 Bytes
Relative change: +0 %
Task-number: QBS-1052
Change-Id: Ic76f9d5f2e74fa694d5584ad3f4f2edf5d5b136d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/corelib/buildgraph/executor.cpp | 1 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/inputartifactscanner.cpp | 7 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/scanresultcache.cpp | 9 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/scanresultcache.h | 1 |
4 files changed, 4 insertions, 14 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index d5e45f85b..a763e83bf 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -646,7 +646,6 @@ void Executor::finishArtifact(Artifact *leaf) m_logger.qbsTrace() << "[EXEC] finishArtifact " << relativeArtifactFileName(leaf); finishNode(leaf); - m_scanResultCache.remove(leaf->filePath()); } QString Executor::configString() const diff --git a/src/lib/corelib/buildgraph/inputartifactscanner.cpp b/src/lib/corelib/buildgraph/inputartifactscanner.cpp index cdf38b247..a505d3b21 100644 --- a/src/lib/corelib/buildgraph/inputartifactscanner.cpp +++ b/src/lib/corelib/buildgraph/inputartifactscanner.cpp @@ -290,10 +290,11 @@ resolved: handleDependency(resolvedDependency); if (artifactsToScan && resolvedDependency.file) { if (Artifact *artifactDependency = dynamic_cast<Artifact *>(resolvedDependency.file)) { - // Do not scan artifacts that are being built. Otherwise we might read an incomplete - // file or conflict with the writing process. - if (artifactDependency->buildState != BuildGraphNode::Building) + // Do not scan an artifact that is not built yet: Its contents might still change. + if (artifactDependency->artifactType == Artifact::SourceFile + || artifactDependency->buildState == BuildGraphNode::Built) { artifactsToScan->append(artifactDependency); + } } else { // Add file dependency to the next round of scanning. artifactsToScan->append(resolvedDependency.file); diff --git a/src/lib/corelib/buildgraph/scanresultcache.cpp b/src/lib/corelib/buildgraph/scanresultcache.cpp index 93986264a..9e1b3ccf8 100644 --- a/src/lib/corelib/buildgraph/scanresultcache.cpp +++ b/src/lib/corelib/buildgraph/scanresultcache.cpp @@ -61,14 +61,5 @@ void ScanResultCache::insert(const void *scanner, const QString &fileName, const m_data[scanner].insert(fileName, value); } -void ScanResultCache::remove(const QString &fileName) -{ - ScanResultCacheData::iterator i = m_data.begin(); - while (i != m_data.end()) { - i.value().remove(fileName); - ++i; - } -} - } // namespace Internal } // namespace qbs diff --git a/src/lib/corelib/buildgraph/scanresultcache.h b/src/lib/corelib/buildgraph/scanresultcache.h index a5c670c71..f01431047 100644 --- a/src/lib/corelib/buildgraph/scanresultcache.h +++ b/src/lib/corelib/buildgraph/scanresultcache.h @@ -83,7 +83,6 @@ public: Result value(const void* scanner, const QString &fileName) const; void insert(const void* scanner, const QString &fileName, const Result &value); - void remove(const QString &fileName); private: typedef QHash<const void*, QHash<QString, Result> > ScanResultCacheData; |