forked from qt-creator/qt-creator
QmlJS: Change from QMap to QHash for QString keys.
Tests indicate that lookup in QHash<QString, ...> is more performant even for short strings. Change-Id: I8e5a73d0f1a72e202522f397b16901887f9c3591 Reviewed-on: http://codereview.qt-project.org/5070 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -264,7 +264,7 @@ protected:
|
||||
ReturnOrThrow = 3
|
||||
};
|
||||
State _state;
|
||||
QMap<QString, Node *> _labels;
|
||||
QHash<QString, Node *> _labels;
|
||||
QSet<Node *> _labelledBreaks;
|
||||
|
||||
virtual void onUnreachable(Node *)
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#define QMLDOCUMENT_H
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QPair>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QString>
|
||||
|
@@ -1280,7 +1280,7 @@ template QList<QmlObjectValue *> CppQmlTypes::load< QHash<QString, FakeMetaObjec
|
||||
|
||||
QList<QmlObjectValue *> CppQmlTypes::typesForImport(const QString &packageName, ComponentVersion version) const
|
||||
{
|
||||
QMap<QString, QmlObjectValue *> objectValuesByName;
|
||||
QHash<QString, QmlObjectValue *> objectValuesByName;
|
||||
|
||||
foreach (QmlObjectValue *qmlObjectValue, _typesByPackage.value(packageName)) {
|
||||
if (qmlObjectValue->version() <= version) {
|
||||
|
@@ -159,7 +159,7 @@ Link::Link(const Snapshot &snapshot, const QStringList &importPaths, const Libra
|
||||
// populate global object with context properties from C++
|
||||
ObjectValue *global = d->valueOwner->globalObject();
|
||||
foreach (const ModelManagerInterface::CppData &cppData, cppDataHash) {
|
||||
QMapIterator<QString, QString> it(cppData.contextProperties);
|
||||
QHashIterator<QString, QString> it(cppData.contextProperties);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
const Value *value = 0;
|
||||
|
@@ -114,7 +114,7 @@ public:
|
||||
{
|
||||
public:
|
||||
QList<LanguageUtils::FakeMetaObject::ConstPtr> exportedTypes;
|
||||
QMap<QString, QString> contextProperties;
|
||||
QHash<QString, QString> contextProperties;
|
||||
};
|
||||
|
||||
typedef QHash<QString, CppData> CppDataHash;
|
||||
|
Reference in New Issue
Block a user