Remove Q_FOREACH, reserve space in destination list
ClosedPublic

Authored by bruns on Apr 28 2019, 11:01 AM.

Details

Diff Detail

Repository
R824 Baloo Widgets
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Apr 28 2019, 11:01 AM
Restricted Application added a project: Baloo. · View Herald TranscriptApr 28 2019, 11:01 AM
bruns requested review of this revision.Apr 28 2019, 11:01 AM
astippich added inline comments.Apr 28 2019, 3:19 PM
src/filemetadataprovider.cpp
336

It is probably not a big deal, but if the url is not a local file, this would over-allocate, wouldn't it?

bruns added inline comments.Apr 28 2019, 4:14 PM
src/filemetadataprovider.cpp
336

Yes, but a) its a temporary, b) its an order of magnitude smaller than m_fileitems itself, c) not reserving typically overallocates as well (non-linear grows), and when resizing you need memory for the old and the new list.

bruns marked an inline comment as done.Apr 28 2019, 8:09 PM
astippich accepted this revision.Apr 29 2019, 5:44 AM
This revision is now accepted and ready to land.Apr 29 2019, 5:44 AM
This revision was automatically updated to reflect the committed changes.