diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-14 16:35:40 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-01-19 21:38:24 +0000 |
commit | 57671bebbcfc06d0ad390dd470f51eb1f8556314 (patch) | |
tree | 6a4cdd86460123701ac1e221b4b52969f0741c7f /tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro | |
parent | 7a17340636d8c338f687aa2a904c49a5cbc15526 (diff) |
QGraphicsAnchorLayout: remove a misguided use of QLinkedList
QSimplexConstraints are held in QList everywhere, yet one
single function, getGraphParts(), used a temporary
QLinkedList. It did so because the function repeatedly
walks the list, erasing elements from it until no more
elements have been removed.
Thus, in O-terms, QLinkedList is the correct choice here.
Sadly, O-notation completely ignores the per-element cost,
and this is where QLinkedList suffers. By the time a QList
has shifted all of its elements left once, the QLinkedList
probably has just finished allocating its first node.
So, use a QList instead.
That, however, turns the it = erase(it) loop quadratic, so
re-formulate the processing part as a lambda and use
std::remove_if. Don't even erase until we know how many
items to erase.
As a benefit, we save the final conversion of the remaining
items back to a QList, and we can use QList::op+ to build
the initial list, reducing the number of allocations
performed by that container to one.
Also saves ~770b in text size on optimized GCC 5.3 Linux
AMD64 builds.
Change-Id: Iecf9e7961dd2b6b20039b9b0d472e32b3fae6994
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro')
0 files changed, 0 insertions, 0 deletions