diff options
author | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-04-21 12:10:44 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-05-12 08:04:13 +0000 |
commit | 32897258b4b9309cae9562a61fea280acd954aa5 (patch) | |
tree | ad70434228f38a93b2ef0d8dee0f7524a8c44186 /src/qml/jsruntime/qv4internalclass.cpp | |
parent | f829f12d3d821c6b06a69b20e934f5d1e8053419 (diff) |
V4: Replace QList with std::vector in InternalClass::destroy()
This nearly halves the number of instructions in the benchmark
librarymetrics_performance instantiation #060: it goes from 23M to 17M for
23 iterations.
Change-Id: Icc3cebc19998b67b95e6642b1daa1b2371cdecd2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4internalclass.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4internalclass.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp index a5405dad0d..9660a5e76d 100644 --- a/src/qml/jsruntime/qv4internalclass.cpp +++ b/src/qml/jsruntime/qv4internalclass.cpp @@ -429,11 +429,13 @@ InternalClass *InternalClass::propertiesFrozen() const void InternalClass::destroy() { - QList<InternalClass *> destroyStack; - destroyStack.append(this); + std::vector<InternalClass *> destroyStack; + destroyStack.reserve(64); + destroyStack.push_back(this); - while (!destroyStack.isEmpty()) { - InternalClass *next = destroyStack.takeLast(); + while (!destroyStack.empty()) { + InternalClass *next = destroyStack.back(); + destroyStack.pop_back(); if (!next->engine) continue; next->engine = 0; @@ -441,13 +443,13 @@ void InternalClass::destroy() next->nameMap.~SharedInternalClassData<Identifier *>(); next->propertyData.~SharedInternalClassData<PropertyAttributes>(); if (next->m_sealed) - destroyStack.append(next->m_sealed); + destroyStack.push_back(next->m_sealed); if (next->m_frozen) - destroyStack.append(next->m_frozen); + destroyStack.push_back(next->m_frozen); for (size_t i = 0; i < next->transitions.size(); ++i) { Q_ASSERT(next->transitions.at(i).lookup); - destroyStack.append(next->transitions.at(i).lookup); + destroyStack.push_back(next->transitions.at(i).lookup); } next->transitions.~vector<Transition>(); |