summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-01-25 16:11:27 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-01-26 09:24:29 +0000
commit520afea6b7f1cb89eda0c6a773ef545991f3f4c2 (patch)
treecc1790682e5cd2e865824066cbc6a65172815251 /src/corelib/tools
parent5550e310f901ab6c9d3766900de5f560bc96b5a1 (diff)
QTzTimeZonePrivate: optimize container usage in init().
Iteration over node-based containers is so slow that the number of passes should be minimized. Replace QList with QVector. Saves ~0.2 KBytes in text size with gcc 4.9. Change-Id: I93298b29b06e4a38a6f716d85f127e0af4385461 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 0b5f6bb80e..3fcc8833e8 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -627,8 +627,15 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
// Translate the TZ file into internal format
// Translate the array index based tz_abbrind into list index
- m_abbreviations = abbrevMap.values();
- QList<int> abbrindList = abbrevMap.keys();
+ const int size = abbrevMap.size();
+ m_abbreviations.clear();
+ m_abbreviations.reserve(size);
+ QVector<int> abbrindList;
+ abbrindList.reserve(size);
+ for (auto it = abbrevMap.cbegin(), end = abbrevMap.cend(); it != end; ++it) {
+ m_abbreviations.append(it.value());
+ abbrindList.append(it.key());
+ }
for (int i = 0; i < typeList.size(); ++i)
typeList[i].tz_abbrind = abbrindList.indexOf(typeList.at(i).tz_abbrind);