Don't cache the targetUrlList() result locally, return them from the locally cached m_items. Minor performance improvement as targetUrlList() is now only called (and the list created) when it's requested.
ClosedPublic

Authored by markg on Feb 3 2018, 12:04 AM.

Details

Summary

Small performance improvement of just not caching the targetUrlList() result.
The only use for that list was returning it in KFileItemListProperties::urlList() so we might as well just call m_items.targetUrlList() there and not save it locally.

This came up as redundant list creation when figuring out where all the QUrl objects came from in a drag/drop action in Dolphin.

Test Plan

I did not benchmark this, seems rather trivial.
Ran the testcases (most relevant is probably KFileItemTest), all pass just fine.

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
markg created this revision.Feb 3 2018, 12:04 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 3 2018, 12:04 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
markg requested review of this revision.Feb 3 2018, 12:04 AM
markg edited the test plan for this revision. (Show Details)Feb 3 2018, 12:08 AM
dfaure accepted this revision.Feb 3 2018, 12:20 AM

If urlList() is called often, then this is actually slower (targetUrlList() has to iterate and convert). But yeah I doubt it is called often...

This revision is now accepted and ready to land.Feb 3 2018, 12:20 AM
This revision was automatically updated to reflect the committed changes.