diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2014-12-03 16:08:16 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-12-09 18:34:36 +0100 |
commit | 221b1f31c10d431eb696ded41f597018fb0a8954 (patch) | |
tree | 840ce97bee60519251e75ea99742d849bc376789 /src/core/qchangearbiter_p.h | |
parent | a1d39cf5e53e3fb77a904b3c9bd4d9f0d8acdeda (diff) |
Optimize: Prefer QVector over QList for QObserverList.
This list stores QObserverPair, i.e. a pair of a QFlags and pointer,
which by definition is larger than a pointer. Thus QList allocates
each node on the heap, whereas a QVector can use a single block
of memory.
This reduces allocations and improves iteration speed, as this reduces
the cache misses incurred with QList and pointer chasing.
Change-Id: Ib3a9fbaa099cb41785086857e856072b74211605
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/qchangearbiter_p.h')
-rw-r--r-- | src/core/qchangearbiter_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/qchangearbiter_p.h b/src/core/qchangearbiter_p.h index 75509ed49..6ecefebda 100644 --- a/src/core/qchangearbiter_p.h +++ b/src/core/qchangearbiter_p.h @@ -108,7 +108,7 @@ public: protected: typedef std::vector<QSceneChangePtr> ChangeQueue; typedef QPair<ChangeFlags, QObserverInterface *> QObserverPair; - typedef QList<QObserverPair> QObserverList; + typedef QVector<QObserverPair> QObserverList; void distributeQueueChanges(ChangeQueue *queue); |