Review Request 127215: simplify code, reduce pointer dereferences

Nick Shaforostoff shafff at ukr.net
Mon Feb 29 13:00:07 UTC 2016



> On Feb. 29, 2016, 12:31 p.m., Kai Uwe Broulik wrote:
> > src/sycoca/kbuildservicefactory.cpp, line 167
> > <https://git.reviewboard.kde.org/r/127215/diff/2/?file=445996#file445996line167>
> >
> >     We can't use range-for in Frameworks, right?

in this case i benefit from Q_FOREACH taking a copy of the container


> On Feb. 29, 2016, 12:31 p.m., Kai Uwe Broulik wrote:
> > src/sycoca/kbuildsycoca.cpp, line 143
> > <https://git.reviewboard.kde.org/r/127215/diff/2/?file=445997#file445997line143>
> >
> >     QVector maybe?

doesn't make a difference from performance perspective, see https://marcmutz.wordpress.com/effective-qt/containers/
but just changing qlist to qvector here increases the lib binary size by 15kb (!)


> On Feb. 29, 2016, 12:31 p.m., Kai Uwe Broulik wrote:
> > src/sycoca/kbuildsycoca.cpp, lines 246-248
> > <https://git.reviewboard.kde.org/r/127215/diff/2/?file=445997#file445997line246>
> >
> >     Cache end?

that's too much ))
in other places caching did make sence because container was accessed via pointer


- Nick


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


On Feb. 29, 2016, 12:27 p.m., Nick Shaforostoff wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127215/
> -----------------------------------------------------------
> 
> (Updated Feb. 29, 2016, 12:27 p.m.)
> 
> 
> Review request for KDE Frameworks.
> 
> 
> Repository: kservice
> 
> 
> Description
> -------
> 
> Changes are mostly related to containers/iterators, but there are also few QString related optimizations
> 
> note that i have made a switch from QLinkedList to just QList because it performs better for T=<void*>
> also i have changed QStringList to QSet<QString> in one place to make the code run faster
> 
> 
> Diffs
> -----
> 
>   src/services/kservice.cpp c75bce2 
>   src/services/kservicetype.cpp 2a73ccd 
>   src/sycoca/kbuildmimetypefactory.cpp 340f76a 
>   src/sycoca/kbuildservicefactory.cpp a74f2e8 
>   src/sycoca/kbuildsycoca.cpp e99e906 
>   src/sycoca/kmimeassociations.cpp 9423b27 
>   src/sycoca/ksycocadict.cpp f33d01a 
>   src/sycoca/ksycocafactory.cpp e410581 
>   src/sycoca/ksycocautils_p.h 8db26b0 
> 
> Diff: https://git.reviewboard.kde.org/r/127215/diff/
> 
> 
> Testing
> -------
> 
> all tests pass, except kmimeassociationstest (fakeApplicationService is NULL), but it fails also without my changes
> 
> 
> Thanks,
> 
> Nick Shaforostoff
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160229/ec11b031/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list