diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-02-23 13:44:12 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-02-26 15:13:34 +0000 |
commit | 5163c11952a39458dd6d7ba10391c2b39ccdf86a (patch) | |
tree | 98c03a10d5c9e51a5aa6f950d642ee6a7b93031f /src/qml/jsruntime/qv4engine.cpp | |
parent | a7c0e62b9122a8d210149570be8834401b9b36d3 (diff) |
QtQml: Micro-optimize iterator loops.
Avoid repeated instantiation of end() in loops, use variable instead.
Change-Id: I3bb1c6918cfd16a5dcefbcc03c442e99fe9bf76b
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 1275e2a1d0..2c8a68812a 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -1335,7 +1335,7 @@ static QV4::ReturnedValue objectFromVariantMap(QV4::ExecutionEngine *e, const QV QV4::ScopedObject o(scope, e->newObject()); QV4::ScopedString s(scope); QV4::ScopedValue v(scope); - for (QVariantMap::ConstIterator iter = map.begin(); iter != map.end(); ++iter) { + for (QVariantMap::const_iterator iter = map.begin(), cend = map.end(); iter != cend; ++iter) { s = e->newString(iter.key()); uint idx = s->asArrayIndex(); if (idx > 16 && (!o->arrayData() || idx > o->arrayData()->length() * 2)) @@ -1501,10 +1501,9 @@ static QV4::ReturnedValue variantMapToJS(QV4::ExecutionEngine *v4, const QVarian { QV4::Scope scope(v4); QV4::ScopedObject o(scope, v4->newObject()); - QVariantMap::const_iterator it; QV4::ScopedString s(scope); QV4::ScopedValue v(scope); - for (it = vmap.constBegin(); it != vmap.constEnd(); ++it) { + for (QVariantMap::const_iterator it = vmap.constBegin(), cend = vmap.constEnd(); it != cend; ++it) { s = v4->newIdentifier(it.key()); v = variantToJS(v4, it.value()); uint idx = s->asArrayIndex(); |