[patch] KConfig: Efficient iterators
David Faure
faure at kde.org
Mon Apr 21 21:20:00 CEST 2008
No need to cross-post to k-c-d IMHO.
Good catch; using foreach on keys() is just a way of making things slow indeed.
> Infinite loops [...]
Obviously they were not infinite, they were "just" slow due to creating a QStringList with all the keys in it.
On Monday 21 April 2008, Jarosław Staniek wrote:
>
> - KEntry entry = entryMap[key];
> + KEntry entry = entryMap[ entryMapIt.key() ];
Shouldn't this simply be entryMapIt.value()?
Later on:
> + if (entryMapIt.key().mKey.isNull() && !entryMapIt.key().mGroup.isEmpty() &&
> + entryMapIt.key().mGroup != "<default>" && entryMapIt.key().mGroup != "$Version")
> + groups << QString::fromUtf8(entryMapIt.key().mGroup);
So many repetitions of entryMapIt.key() make me wish for a local variable equal to it :)
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the Kde-optimize
mailing list