diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-04-15 11:24:26 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-06-24 08:14:01 +0000 |
commit | f291ceaea3d9fffe6794415d8e5ecf44225097fb (patch) | |
tree | 89991ffea9f4820c038965425d4a883411a38304 /src/qml/compiler/qv4jsir_p.h | |
parent | 9ab8b9e4bdf313bb4304be206dd479d4d0848211 (diff) |
QML: Store idObjectDependencies in a QVarLengthArray.
The number of id objects referenced from a function or binding is
often very small. So using a QSet that allocates hash nodes takes more
memory, and is actually slower than using an array.
Change-Id: Id9fa60a860314790284f66318593b3ef938e6eef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4jsir_p.h')
-rw-r--r-- | src/qml/compiler/qv4jsir_p.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h index c196e8127b..a2bd6ad044 100644 --- a/src/qml/compiler/qv4jsir_p.h +++ b/src/qml/compiler/qv4jsir_p.h @@ -1193,6 +1193,20 @@ private: unsigned _isRemoved : 1; }; +template <typename T> +class SmallSet: public QVarLengthArray<T, 8> +{ +public: + void insert(int value) + { + for (auto it : *this) { + if (it == value) + return; + } + this->append(value); + } +}; + // Map from meta property index (existence implies dependency) to notify signal index struct KeyValuePair { @@ -1266,7 +1280,7 @@ struct Function { int column; // Qml extension: - QSet<int> idObjectDependencies; + SmallSet<int> idObjectDependencies; PropertyDependencyMap contextObjectPropertyDependencies; PropertyDependencyMap scopeObjectPropertyDependencies; |