From c3b6a6413636a17a74e777e65d271954392867ca Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 21 Dec 2014 20:15:09 +0100 Subject: [PATCH] QV4: Lower time spent in indirections and allocations. Change data type for defsUntyped from QList -> QVector & reserve space when creating the list. Drops ~250ms off a pretty morbid QML testcase, most, but not all of which was spent in allocations. Change-Id: I2ed8c62e7d41ab353a0194da268a2b430f079474 Reviewed-by: Simon Hausmann --- src/qml/compiler/qv4ssa.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 77cfab8..69be6b3 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -1145,9 +1145,10 @@ public: defUse.blockOfStatement = defBlock; } - QList defsUntyped() const + QVector defsUntyped() const { - QList res; + QVector res; + res.reserve(tempCount()); foreach (const DefUse &du, _defUses) if (du.isValid()) res.append(UntypedTemp(du.temp)); @@ -2524,7 +2525,7 @@ public: Q_UNUSED(f); QVector knownOk; - QList candidates = _defUses.defsUntyped(); + QVector candidates = _defUses.defsUntyped(); while (!candidates.isEmpty()) { UntypedTemp temp = candidates.last(); candidates.removeLast(); -- 2.7.4