Review Request 115018: Use the QMap iterator instead of foreach(key, map.keys()).

Frank Reininghaus frank78ac at googlemail.com
Wed Jan 15 13:52:59 GMT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115018/#review47446
-----------------------------------------------------------

Ship it!


Thanks for the patch! I first thought that replacing the foreach loop would probably not affect the performance much, but when iterating the keys of a QMap, rather than, e.g., the elements of a QVector, it saves the creation of the temporary list returned by itemStates.keys() (I guess that this was also the explanation that Thiago gave - maybe it was in a private discussion, Mark? I could not see any comment from Thiago here).

One could in principle move the declaration of 'it' into the for statement, but I assume that you did not do this in order to prevent that the line gets too long? Either solution is fine for me.

- Frank Reininghaus


On Jan. 15, 2014, 12:03 a.m., Emmanuel Pescosta wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115018/
> -----------------------------------------------------------
> 
> (Updated Jan. 15, 2014, 12:03 a.m.)
> 
> 
> Review request for Dolphin.
> 
> 
> Repository: kde-baseapps
> 
> 
> Description
> -------
> 
> Use the QMap iterator instead of foreach(key, map.keys()) in UpdateItemStatesThread::run() and in VersionControlObserver::slotThreadFinished().
> 
> 
> Diffs
> -----
> 
>   dolphin/src/views/versioncontrol/updateitemstatesthread.cpp 6be07d3 
>   dolphin/src/views/versioncontrol/versioncontrolobserver.cpp 4d939ee 
> 
> Diff: https://git.reviewboard.kde.org/r/115018/diff/
> 
> 
> Testing
> -------
> 
> Works ;)
> 
> 
> Thanks,
> 
> Emmanuel Pescosta
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20140115/99d6cb2c/attachment.htm>


More information about the kfm-devel mailing list