diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-03-20 12:34:29 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-03-20 22:25:03 +0000 |
commit | c33ee0fe1517021ff2f22a8aab0331e4145c5f3f (patch) | |
tree | d5c8deabb7aebbe6afb7c9a26666334b6fb9216d /src/network/access/qhttpnetworkconnection.cpp | |
parent | e54356151cd47aabefed7800695defa176228d68 (diff) |
QDataWidgetMapper: replace an inefficient QList with std::vector
WidgetMapper is larger than a void*, so holding it in QLists is
needlessly inefficient. Worse, the code could come to depend on the
fragile property of (inefficient) QLists that references to elements
therein never are invalidated.
Fix by holding it in a std::vector instead (tried QVector, too, but
that produced almost exactly 1KiB more text size). Adapt to std API.
There are a few changes in there which are not strictly necessary when
using std::vector, but were done as part of the port to QVector:
- dropping of WidgetMapper ctors (because QVector requires a default
ctor, and I didn't want to provide one manually),
- marking the type as movable (no effect with std::vector, but doesn't
hurt and keeps the next guy from wondering), and
- marking Private::flipEventFilters() const (to avoid a detach when
using ranged for loops).
Changes required by the port to std::vector:
- at() -> op[] (not strictly necessary, but expands to less code even
when compiling, as QtWidgets is, without exception support),
- append() -> push_back()
Saves 40B in text size on optimized GCC 6.1 Linux AMD64 builds (for
comparison: QVector had 1240B more than QList).
Change-Id: Iaae81d1a8bebe8000bf69e7fb8b2bcd6c38afafd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/network/access/qhttpnetworkconnection.cpp')
0 files changed, 0 insertions, 0 deletions