From 8a46dd8d8e2374fda5a27d2079ef30722ee08000 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 15 Jan 2014 20:27:20 +0100 Subject: 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 --- src/views/versioncontrol/updateitemstatesthread.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/views/versioncontrol/updateitemstatesthread.cpp') 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& items = m_itemStates[directory]; + QMap >::iterator it = m_itemStates.begin(); + for (; it != m_itemStates.end(); ++it) { + if (m_plugin->beginRetrieval(it.key())) { + QVector& items = it.value(); const int count = items.count(); KVersionControlPlugin2* pluginV2 = qobject_cast(m_plugin); -- cgit v1.3