diff options
| author | Emmanuel Pescosta <[email protected]> | 2014-01-15 20:27:20 +0100 |
|---|---|---|
| committer | Emmanuel Pescosta <[email protected]> | 2014-01-15 20:27:20 +0100 |
| commit | 8a46dd8d8e2374fda5a27d2079ef30722ee08000 (patch) | |
| tree | 1e99573f0d8e14dd8f06240c011da80a5fb18329 /src/views/versioncontrol/updateitemstatesthread.cpp | |
| parent | 3ff6e83491e2da9678af0bc149e450ff87db5e8d (diff) | |
Use the QMap iterator instead of foreach(key, map.keys()) in UpdateItemStatesThread::run()
and in VersionControlObserver::slotThreadFinished().
So we get O(n) complexity instead of O(n*logn), and O(1) memory instead of O(n).
Thanks to Thiago Macieira for providing this information.
FIXED-IN: 4.13
REVIEW: 115018
Diffstat (limited to 'src/views/versioncontrol/updateitemstatesthread.cpp')
| -rw-r--r-- | src/views/versioncontrol/updateitemstatesthread.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/views/versioncontrol/updateitemstatesthread.cpp b/src/views/versioncontrol/updateitemstatesthread.cpp index 6be07d361..db50aa2e8 100644 --- a/src/views/versioncontrol/updateitemstatesthread.cpp +++ b/src/views/versioncontrol/updateitemstatesthread.cpp @@ -50,9 +50,10 @@ void UpdateItemStatesThread::run() m_retrievedItems = false; QMutexLocker pluginLocker(m_globalPluginMutex); - foreach (const QString& directory, m_itemStates.keys()) { - if (m_plugin->beginRetrieval(directory)) { - QVector<VersionControlObserver::ItemState>& items = m_itemStates[directory]; + QMap<QString, QVector<VersionControlObserver::ItemState> >::iterator it = m_itemStates.begin(); + for (; it != m_itemStates.end(); ++it) { + if (m_plugin->beginRetrieval(it.key())) { + QVector<VersionControlObserver::ItemState>& items = it.value(); const int count = items.count(); KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin); |
