mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
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
This commit is contained in:
parent
3ff6e83491
commit
8a46dd8d8e
|
@ -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);
|
||||
|
|
|
@ -205,8 +205,9 @@ void VersionControlObserver::slotThreadFinished()
|
|||
}
|
||||
|
||||
const QMap<QString, QVector<ItemState> >& itemStates = thread->itemStates();
|
||||
foreach (const QString& directory, itemStates.keys()) {
|
||||
const QVector<ItemState>& items = itemStates.value(directory);
|
||||
QMap<QString, QVector<ItemState> >::const_iterator it = itemStates.constBegin();
|
||||
for (; it != itemStates.constEnd(); ++it) {
|
||||
const QVector<ItemState>& items = it.value();
|
||||
|
||||
foreach (const ItemState& item, items) {
|
||||
QHash<QByteArray, QVariant> values;
|
||||
|
|
Loading…
Reference in a new issue