summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlexpression.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-08-05 06:23:41 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-08-05 06:23:41 (GMT)
commit6e682a64153f0b3f96a412a72dab0158e3f8e365 (patch)
tree52ff7c6b6cf4485935029d6de0b9ef1601e12a2a /src/declarative/qml/qmlexpression.cpp
parent3c85728f2cb69817d4b72d3aab16b7a7fe6bdbf0 (diff)
downloadQt-6e682a64153f0b3f96a412a72dab0158e3f8e365.zip
Qt-6e682a64153f0b3f96a412a72dab0158e3f8e365.tar.gz
Qt-6e682a64153f0b3f96a412a72dab0158e3f8e365.tar.bz2
Use a linked list instead of a QSet<> to track expressions
While the QSet<> wasn't that expensive, the QmlContext only tracks the expressions to stop programmers doing something "stupid" so any overhead is unacceptable. This does give a measurable improvement.
Diffstat (limited to 'src/declarative/qml/qmlexpression.cpp')
-rw-r--r--src/declarative/qml/qmlexpression.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index 148ff71..3206734 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -51,7 +51,7 @@ Q_DECLARE_METATYPE(QList<QObject *>);
QT_BEGIN_NAMESPACE
QmlExpressionPrivate::QmlExpressionPrivate()
-: ctxt(0), expressionFunctionValid(false), expressionRewritten(false), sseData(0), me(0), trackChange(true), line(-1), guardList(0), guardListLength(0)
+: nextExpression(0), prevExpression(0), ctxt(0), expressionFunctionValid(false), expressionRewritten(false), sseData(0), me(0), trackChange(true), line(-1), guardList(0), guardListLength(0)
{
}
@@ -63,8 +63,12 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, const QString &expr,
expression = expr;
this->ctxt = ctxt;
- if (ctxt)
- ctxt->d_func()->childExpressions.insert(q);
+ if (ctxt) {
+ QmlContextPrivate *cp = ctxt->d_func();
+ nextExpression = cp->expressions;
+ prevExpression = &cp->expressions;
+ cp->expressions = this;
+ }
this->me = me;
}
@@ -84,8 +88,12 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
}
this->ctxt = ctxt;
- if (ctxt)
- ctxt->d_func()->childExpressions.insert(q);
+ if (ctxt) {
+ QmlContextPrivate *cp = ctxt->d_func();
+ nextExpression = cp->expressions;
+ prevExpression = &cp->expressions;
+ cp->expressions = this;
+ }
this->me = me;
}
@@ -152,8 +160,11 @@ QmlExpression::QmlExpression(QmlContext *ctxt, const QString &expression,
QmlExpression::~QmlExpression()
{
Q_D(QmlExpression);
- if (d->ctxt)
- d->ctxt->d_func()->childExpressions.remove(this);
+ if (d->prevExpression) {
+ *(d->prevExpression) = d->nextExpression;
+ if (d->nextExpression)
+ d->nextExpression->prevExpression = d->prevExpression;
+ }
}
/*!