From b974fac576b620436af64ad8b617f2276b756a05 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sat, 10 Jan 2015 22:12:29 +0100 Subject: Implement DefUses::Temps with a QVarLengthArray. Avoiding heap allocations here shaves 100ms or so off the optimizer runtime. Change-Id: If00c757532ffe90f2fa9c62dc999bb69e25bb71c Task-number: QTBUG-43719 Reviewed-by: Erik Verbruggen --- src/qml/compiler/qv4ssa.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/qml/compiler') diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index c0a14a5c80..f47839f061 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -1073,10 +1073,7 @@ public: private: std::vector _defUses; - class Temps: public QVector { - public: - Temps() { reserve(4); } - }; + typedef QVarLengthArray Temps; std::vector _usesPerStatement; void ensure(Temp *newTemp) @@ -1219,7 +1216,7 @@ public: ensure(s); } - const QVector &usedVars(Stmt *s) const + const Temps &usedVars(Stmt *s) const { Q_ASSERT(s->id() >= 0); Q_ASSERT(static_cast(s->id()) < _usesPerStatement.size()); -- cgit v1.2.3