[FileContentIndexer] Remove duplicate condition check for loop break
ClosedPublic

Authored by bruns on Mar 1 2020, 4:56 PM.

Details

Summary

Counting the number of files to be indexed (m_provider->size()) can
be significantly more costly than checking if the next batch is empty.
Also the m_stop condition was checked twice.

Diff Detail

Repository
R293 Baloo
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.Mar 1 2020, 4:56 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptMar 1 2020, 4:56 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Mar 1 2020, 4:56 PM

Hmm, changing the loop to while (true) would seem to reduce some safety if none of the break conditions are reached.

bruns added inline comments.Mar 4 2020, 10:40 PM
src/file/filecontentindexer.cpp
69 ↗(On Diff #76733)

@ngraham - you mean this condition, which comes immediately after?

ngraham accepted this revision.Mar 4 2020, 10:48 PM

Oh so it does!

This revision is now accepted and ready to land.Mar 4 2020, 10:48 PM
This revision was automatically updated to reflect the committed changes.