[Coding] Avoid recurrent detach and size checks
ClosedPublic

Authored by bruns on Apr 18 2020, 12:22 AM.

Details

Summary

QVector::append() is quite expensive, as each access checks if the array
needs to be detached or has to grow. Resizing the array and setting
the elements with an iterator is significantly faster.

Test Plan

valgrind --tool=callgrind baloosearch the_test.txt

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.Apr 18 2020, 12:22 AM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptApr 18 2020, 12:22 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Apr 18 2020, 12:22 AM
ngraham accepted this revision.Apr 18 2020, 4:28 PM
This revision is now accepted and ready to land.Apr 18 2020, 4:28 PM
This revision was automatically updated to reflect the committed changes.