Review Request 115018: Use the QMap iterator instead of foreach(key, map.keys()).
Mark Gaiser
markg85 at gmail.com
Wed Jan 15 13:11:24 GMT 2014
> On Jan. 15, 2014, 1: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".
>
> Emmanuel Pescosta wrote:
> > 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
I'm glad i learned about this! (A thank you for Thiago as well - again - for explaining the reason behind the difference).
This will certainly motivate me in my own pet projects to use iterators more often :)
- Mark
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115018/#review47420
-----------------------------------------------------------
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/ce7c67df/attachment.htm>
More information about the kfm-devel
mailing list