diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-05-20 09:43:52 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-05-20 13:19:25 +0200 |
commit | 5bb746520db70b09de463f0ce27ecfbe3e5dfb4f (patch) | |
tree | 932a287c2e834dfcb4fb83839fcb10b4f8a50b6d /src/qml/jsruntime/qv4executablecompilationunit_p.h | |
parent | ae1334d827bd386ae34ed5fca8f00dcef83bc65e (diff) |
Use QHash instead of QMap for resolved types
This vastly speeds up resolved type reference lookups in
QQmlObjectCreator::createInstance, which translates to significant
improvements in qmlbench:
perf record -b ./src/qmlbench --shell frame-count delegates_qobject.qml
went from roughly 730 frames to > 800 locally.
To have a stable order in the hash, we simply sort a tempory vector of
keys. As this happens only once, the overhead is negligible and
partially offset by the better memory locality of the QHash anyway.
Task-number: QTBUG-88672
Change-Id: Ib547a87fd0d2d81f366ea927ade232f33b3d3788
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit_p.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit_p.h b/src/qml/jsruntime/qv4executablecompilationunit_p.h index 3dc0e58ca5..9ceec1fbf7 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit_p.h +++ b/src/qml/jsruntime/qv4executablecompilationunit_p.h @@ -92,9 +92,7 @@ typedef QVector<QQmlPropertyData*> BindingPropertyData; class CompilationUnitMapper; class ResolvedTypeReference; // map from name index -// While this could be a hash, a map is chosen here to provide a stable -// order, which is used to calculating a check-sum on dependent meta-objects. -struct ResolvedTypeReferenceMap: public QMap<int, ResolvedTypeReference*> +struct ResolvedTypeReferenceMap: public QHash<int, ResolvedTypeReference*> { bool addToHash(QCryptographicHash *hash, QQmlEngine *engine) const; }; |