diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-07-16 15:56:26 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2014-07-17 09:56:01 +0200 |
commit | 1c982622acd9e38096dd9feabe8e5a4c129df31c (patch) | |
tree | 0770391f480ffb0425258071cef73a604078e8f0 /src/lib/corelib/buildgraph | |
parent | 4d0a76fafebf11af4ab948e60f9f8eae7097fca8 (diff) |
speed up ResolvedProduct::lookupArtifactsByFileTag
Change-Id: Id2f55d64dcbaf6c1b80009a13d48ed823ee213cd
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/lib/corelib/buildgraph')
-rw-r--r-- | src/lib/corelib/buildgraph/buildgraph.cpp | 1 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/productbuilddata.cpp | 12 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/productbuilddata.h | 2 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/projectbuilddata.cpp | 1 |
4 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/corelib/buildgraph/buildgraph.cpp b/src/lib/corelib/buildgraph/buildgraph.cpp index 0a231a67a..39fdc2851 100644 --- a/src/lib/corelib/buildgraph/buildgraph.cpp +++ b/src/lib/corelib/buildgraph/buildgraph.cpp @@ -437,6 +437,7 @@ void insertArtifact(const ResolvedProductPtr &product, Artifact *artifact, const } #endif product->buildData->nodes.insert(artifact); + addArtifactToSet(artifact, product->buildData->artifactsByFileTag); artifact->product = product; product->topLevelProject()->buildData->insertIntoLookupTable(artifact); product->topLevelProject()->buildData->isDirty = true; diff --git a/src/lib/corelib/buildgraph/productbuilddata.cpp b/src/lib/corelib/buildgraph/productbuilddata.cpp index c0e23b2db..5cdf69923 100644 --- a/src/lib/corelib/buildgraph/productbuilddata.cpp +++ b/src/lib/corelib/buildgraph/productbuilddata.cpp @@ -77,6 +77,7 @@ void ProductBuildData::load(PersistentPool &pool) elem.load(pool); rescuableArtifactData.insert(filePath, elem); } + loadArtifactSetByFileTag(pool, artifactsByFileTag); loadArtifactSetByFileTag(pool, addedArtifactsByFileTag); loadArtifactSetByFileTag(pool, removedArtifactsByFileTag); @@ -110,6 +111,7 @@ void ProductBuildData::store(PersistentPool &pool) const pool.storeString(it.key()); it.value().store(pool); } + storeArtifactSetByFileTag(pool, artifactsByFileTag); storeArtifactSetByFileTag(pool, addedArtifactsByFileTag); storeArtifactSetByFileTag(pool, removedArtifactsByFileTag); @@ -127,5 +129,15 @@ void addArtifactToSet(Artifact *artifact, ProductBuildData::ArtifactSetByFileTag container[tag] += artifact; } +void removeArtifactFromSet(Artifact *artifact, ProductBuildData::ArtifactSetByFileTag &container) +{ + foreach (const FileTag &t, artifact->fileTags) { + ArtifactSet &s = container[t]; + s.remove(artifact); + if (s.isEmpty()) + container.remove(t); + } +} + } // namespace Internal } // namespace qbs diff --git a/src/lib/corelib/buildgraph/productbuilddata.h b/src/lib/corelib/buildgraph/productbuilddata.h index 61b072c2d..07193ea9a 100644 --- a/src/lib/corelib/buildgraph/productbuilddata.h +++ b/src/lib/corelib/buildgraph/productbuilddata.h @@ -63,6 +63,7 @@ public: unsigned int buildPriority; typedef QHash<FileTag, ArtifactSet> ArtifactSetByFileTag; + ArtifactSetByFileTag artifactsByFileTag; ArtifactSetByFileTag addedArtifactsByFileTag; ArtifactSetByFileTag removedArtifactsByFileTag; @@ -75,6 +76,7 @@ private: }; void addArtifactToSet(Artifact *artifact, ProductBuildData::ArtifactSetByFileTag &container); +void removeArtifactFromSet(Artifact *artifact, ProductBuildData::ArtifactSetByFileTag &container); } // namespace Internal } // namespace qbs diff --git a/src/lib/corelib/buildgraph/projectbuilddata.cpp b/src/lib/corelib/buildgraph/projectbuilddata.cpp index 327154e8e..978acecad 100644 --- a/src/lib/corelib/buildgraph/projectbuilddata.cpp +++ b/src/lib/corelib/buildgraph/projectbuilddata.cpp @@ -273,6 +273,7 @@ void ProjectBuildData::removeArtifact(Artifact *artifact, if (removeFromProduct) { artifact->product->buildData->nodes.remove(artifact); artifact->product->buildData->roots.remove(artifact); + removeArtifactFromSet(artifact, artifact->product->buildData->artifactsByFileTag); } // If removal is requested and the executor has not run since the time the artifact was last |