diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-12-23 14:56:11 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2016-12-23 14:56:48 +0000 |
commit | 2f4fe27766682855867b49b45b74eca7056f16b7 (patch) | |
tree | c1e3a884becc95e26d31266379cbedf62fa940a6 /src/lib/corelib/buildgraph/nodeset.cpp | |
parent | 1ce6453d000f03d018cb8c6dc98cdf069a8df7d6 (diff) |
Use a vector instead of a set to hold build graph nodes
The set even loses in the purely instruction count based metric employed
in our benchmarking tool.
A quick test with a larger project shows no performance advantage of the
set either.
========== Performance data for Rule Execution ==========
Old instruction count: 3485129349
New instruction count: 3456144664
Relative change: -1 %
Old peak memory usage: 17597368 Bytes
New peak memory usage: 16750392 Bytes
Relative change: -5 %
========== Performance data for Null Build ==========
Old instruction count: 451359636
New instruction count: 439286904
Relative change: -3 %
Old peak memory usage: 13141728 Bytes
New peak memory usage: 12246952 Bytes
Relative change: -7 %
Change-Id: I8fead52f728e7078dade1f021fdb28017a17fe43
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/nodeset.cpp')
-rw-r--r-- | src/lib/corelib/buildgraph/nodeset.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/corelib/buildgraph/nodeset.cpp b/src/lib/corelib/buildgraph/nodeset.cpp index 3b3f2b781..faeba732c 100644 --- a/src/lib/corelib/buildgraph/nodeset.cpp +++ b/src/lib/corelib/buildgraph/nodeset.cpp @@ -48,26 +48,23 @@ namespace qbs { namespace Internal { -NodeSet::NodeSet() - : d(new NodeSetData) -{ -} - NodeSet &NodeSet::unite(const NodeSet &other) { - d->m_data.insert(other.begin(), other.end()); + for (auto node = other.m_data.cbegin(); node != other.m_data.cend(); ++node) + insert(*node); return *this; } void NodeSet::remove(BuildGraphNode *node) { - d->m_data.erase(node); + m_data.removeOne(node); } void NodeSet::load(PersistentPool &pool) { clear(); int i = pool.load<int>(); + reserve(i); for (; --i >= 0;) { const auto t = pool.load<quint8>(); BuildGraphNode *node = 0; @@ -80,7 +77,7 @@ void NodeSet::load(PersistentPool &pool) break; } QBS_CHECK(node); - insert(node); + m_data << node; } } |