diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-03-27 14:50:20 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-31 22:54:14 +0200 |
commit | adf0db5243c44a66639fc8f5462eb2d38e85bd9f (patch) | |
tree | df4779e5ca73ee2e9e3066e78f4f8dc0fd094717 /src | |
parent | 47d2d19cf6bceb0421f5dbff3686ec093daeba1c (diff) |
QStringList::join: micro-optimization
Don't call that->size() if we have already saved its value in a local temp.
Surprisingly, this saves 56B in text size even on a -O3 GCC build, proving
that the compiler does _not_ have enough context to const-fold the repeated
size() evaluation.
Change-Id: I2c41ddc4376f4e1534fc2f0d4789e42b984d3ba6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qstringlist.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index a7379b144c..a47af4adbd 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -443,7 +443,7 @@ QString QtPrivate::QStringList_join(const QStringList *that, const QChar *sep, i if (totalLength == 0) return res; res.reserve(totalLength); - for (int i = 0; i < that->size(); ++i) { + for (int i = 0; i < size; ++i) { if (i) res.append(sep, seplen); res += that->at(i); |