diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2014-12-09 00:47:46 -0800 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2014-12-17 08:55:16 +0100 |
commit | b10570d6498c0789d81cd287a5c1165d9a23d257 (patch) | |
tree | d5271b5c167997670752b5446715306af54fb453 | |
parent | 7f325ecbc2875b17fb95e13de3073bf29d3fb348 (diff) |
Simple cache of url for QQmlCompiledData
Removes URL parsing and allocation/deallocation overhead as a bottleneck from
cached instantiation. Takes total runtime percentage of beginCreate from 6208ms
to 4987ms out of a 15 second trace of the instantiation_cached librarymetrics
benchmark with the empty Item data.
Task-number: QTBUG-43096
Change-Id: Ie4ec8e83461b4926e502dd78a7178cc8e8131e70
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmlcompiler_p.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 2f335958e6..30e7795bb3 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -37,9 +37,12 @@ #include <QVector> #include <QStringList> #include <QHash> +#include <QUrl> + #include <private/qv4value_p.h> #include <private/qv4executableallocator_p.h> #include <private/qqmlrefcount_p.h> +#include <private/qqmlnullablevalue_p_p.h> QT_BEGIN_NAMESPACE @@ -586,12 +589,14 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public QQmlRefCount #ifndef V4_BOOTSTRAP ExecutionEngine *engine; QString fileName() const { return data->stringAt(data->sourceFileIndex); } + QUrl url() const { if (m_url.isNull) m_url = QUrl(fileName()); return m_url; } QV4::Heap::String **runtimeStrings; // Array QV4::Lookup *runtimeLookups; QV4::Value *runtimeRegularExpressions; QV4::InternalClass **runtimeClasses; QVector<QV4::Function *> runtimeFunctions; + mutable QQmlNullableValue<QUrl> m_url; QV4::Function *linkToEngine(QV4::ExecutionEngine *engine); void unlink(); diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h index 5e76533739..3569a106c9 100644 --- a/src/qml/qml/qqmlcompiler_p.h +++ b/src/qml/qml/qqmlcompiler_p.h @@ -84,7 +84,7 @@ public: QQmlEngine *engine; QString fileName() const { return compilationUnit->fileName(); } - QUrl url() const { return QUrl(fileName()); } + QUrl url() const { return compilationUnit->url(); } QQmlTypeNameCache *importCache; int metaTypeId; |