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

Emmanuel Pescosta emmanuelpescosta099 at gmail.com
Wed Jan 15 11:44:16 GMT 2014



> On Jan. 15, 2014, 2:02 a.m., Mark Gaiser wrote:
> > Is there a reason why you want to change this?
> > I mean, it seems a matter of taste. I kinda like the foreach version ;)
> > 
> > Not my place to say +1 or -1 so i leave that to others, just curious abdout the "why".

> Is there a reason why you want to change this?
Yes, efficiency ;)

I made a benchmark QMap foreach vs QMap (const) iterator with 100000 items. (Test was done 10 times)
Key type: QString - min. 30 characters to simulate real world paths / Value type: QVector<ItemState>

foreach: 124.7 ms
const iterator: 7.6 ms
iterator: 7.67 ms


- Emmanuel


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


On Jan. 15, 2014, 1: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, 1: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/007a7f6b/attachment.htm>


More information about the kfm-devel mailing list