aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-08-05 12:38:43 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-05 15:14:13 +0200
commita7f0e770f6452d68998114c3d05187b79a879d2c (patch)
treea5e084c8b94f987964fb066a3a90df41b2e20c40 /src
parentf86e123ea6c989e5f5b9e31733d596485e78cefe (diff)
Optimize lookups in the property cache
Change-Id: I0df182a18ab35ad8744fd23243286c7c501cd4a9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index d2000081a7..d10af391f5 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1340,6 +1340,8 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()");
static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()");
+ const QByteArray propertyName = property.toUtf8();
+
int methodCount = metaObject->methodCount();
for (int ii = methodCount - 1; ii >= 0; --ii) {
if (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx)
@@ -1347,9 +1349,8 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
QMetaMethod m = metaObject->method(ii);
if (m.access() == QMetaMethod::Private)
continue;
- QString methodName = QString::fromUtf8(m.name().constData());
- if (methodName == property) {
+ if (m.name() == propertyName) {
rv.load(m);
return rv;
}
@@ -1357,7 +1358,6 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
{
const QMetaObject *cmo = metaObject;
- const QByteArray propertyName = property.toUtf8();
while (cmo) {
int idx = cmo->indexOfProperty(propertyName);
if (idx != -1) {