diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-01-18 16:01:46 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-01-26 11:59:28 +0000 |
commit | 898d09d4790e94e9d5e92a39440866932cd7f211 (patch) | |
tree | 61de213a735e0f1ce0afb7cc308420d562f1f4ef /src/lib/corelib/buildgraph/productbuilddata.cpp | |
parent | 25fc120303bb8feddd5f7096f8b5f7177a8f9ba8 (diff) |
Re-use product, module and project script values
These script values were set up from scratch not only for every rule,
but also when creating the dependencies array. As a result, a rule
traversing the dependencies of a product recursively would potentially
create a huge amount of identical script values for modules appearing
more than once in the dependency graph, such as the qbs module. See the
benchmark data below for how the performance degraded with the size of
the project.
Instead, we now re-use these values, which stay valid throughout the
lifetime of the script engine. For prepare scripts, that's the same as
the lifetime of the executor.
As a side effect, this also gives us change tracking for accesses to
product and module properties via the dependencies array. These were
completely unobserved before.
Benchmarker result using qbs as the test project:
========== Performance data for Rule Execution ==========
Old instruction count: 3265471304
New instruction count: 2733833913
Relative change: -17 %
Old peak memory usage: 19023592 Bytes
New peak memory usage: 19871640 Bytes
Relative change: +4 %
Benchmarker result using Qt Creator as the test project:
========== Performance data for Rule Execution ==========
Old instruction count: 318848392341
New instruction count: 75056789023
Relative change: -77 %
Old peak memory usage: 248922136 Bytes
New peak memory usage: 258454408 Bytes
Relative change: +3 %
Change-Id: Id69062eea4dd8f9c7153599610c52bf4ea986464
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/productbuilddata.cpp')
-rw-r--r-- | src/lib/corelib/buildgraph/productbuilddata.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/corelib/buildgraph/productbuilddata.cpp b/src/lib/corelib/buildgraph/productbuilddata.cpp index 07dc45378..8369bc762 100644 --- a/src/lib/corelib/buildgraph/productbuilddata.cpp +++ b/src/lib/corelib/buildgraph/productbuilddata.cpp @@ -86,8 +86,10 @@ void ProductBuildData::store(PersistentPool &pool) const void ProductBuildData::addArtifactToSet(Artifact *artifact) { - for (const FileTag &tag : artifact->fileTags()) + for (const FileTag &tag : artifact->fileTags()) { m_artifactsByFileTag[tag] += artifact; + m_jsArtifactsMapUpToDate = false; + } } void ProductBuildData::removeArtifact(Artifact *artifact) @@ -105,11 +107,13 @@ void ProductBuildData::removeArtifactFromSetByFileTag(Artifact *artifact, const it->remove(artifact); if (it->empty()) m_artifactsByFileTag.erase(it); + m_jsArtifactsMapUpToDate = false; } void ProductBuildData::addFileTagToArtifact(Artifact *artifact, const FileTag &tag) { m_artifactsByFileTag[tag] += artifact; + m_jsArtifactsMapUpToDate = false; } void ProductBuildData::addArtifactWithChangedInputsForRule(const RuleConstPtr &rule, |