summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusmetaobject.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-12-05 16:59:27 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-06 18:18:44 +0100
commit105d10dea9d790a69595a2e73e8fea80a5d1a3ad (patch)
tree68c8cfb65c6c23ebb44ea1436da4b0c354bd95a2 /src/dbus/qdbusmetaobject.cpp
parent0c936ca83c40b73f30195a619900f2be98b9e968 (diff)
Fix quadratic behavior in QMetaObjectBuilder when writing string table
QHash::key() is O(n) and we're calling it n times. That can make repeated calls to the meta object builder very slow, as for example QQmlPropertyMap when inserting properties repeatedly. Fortunately this is easy to fix, as the value in the hash map is also the index, so we can simply iterate over the hash once. With the exception of the class name, which we have to treat specially to ensure that it is always the first entry in the string table. Task-number: QTBUG-32720 Change-Id: Ic954c45c454107feee83216131f601cc69d4c63b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/dbus/qdbusmetaobject.cpp')
-rw-r--r--src/dbus/qdbusmetaobject.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp
index 51c0b27668..13c538bb59 100644
--- a/src/dbus/qdbusmetaobject.cpp
+++ b/src/dbus/qdbusmetaobject.cpp
@@ -445,8 +445,7 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
idata.resize(data_size + 1);
- QMetaStringTable strings;
- strings.enter(className.toLatin1());
+ QMetaStringTable strings(className.toLatin1());
int offset = header->methodData;
int parametersOffset = offset + header->methodCount * 5;