[Plasma PluginLoader] Cache plugins during startup
ClosedPublic

Authored by broulik on Jul 9 2018, 4:59 PM.

Details

Summary

Similar to KPackage's cache this speeds up startup where plugins are repeatedly looked up.
Especially the fallback path of looking in the plugin root directly causes quite some slowdown.

Test Plan

Speeds up plasmashell startup by ~175ms both with and without dropped caches on my laptop

Verified that all applets load fine and that adding applets (both QML-only and C++ applets) after the startup period works fine

Diff Detail

Repository
R242 Plasma Framework (Library)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Jul 9 2018, 4:59 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 9 2018, 4:59 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
broulik requested review of this revision.Jul 9 2018, 4:59 PM
zzag added a subscriber: zzag.Jul 9 2018, 7:01 PM
zzag added inline comments.
src/plasma/pluginloader.cpp
220–230

Nitpick: IMHO, it would be better to move these two down (right before if (useRuntimeCache) {). So, cache invalidation and cache population stuff goes first, then querying stuff.

broulik updated this revision to Diff 37473.Jul 9 2018, 7:25 PM
  • Move code
mart accepted this revision.Jul 17 2018, 1:21 PM
This revision is now accepted and ready to land.Jul 17 2018, 1:21 PM
davidedmundson added inline comments.Jul 17 2018, 1:22 PM
src/plasma/pluginloader.cpp
195

Seems the wrong approach we know the ID, there's no point iterating in the first place.

https://api.kde.org/frameworks/kcoreaddons/html/classKPluginLoader.html#a3a69c4f1826926a2145f14770b8b5010

broulik added inline comments.Jul 17 2018, 1:42 PM
src/plasma/pluginloader.cpp
195

We know the ID but not the file name of the library, so findPlugin won't work.

This revision was automatically updated to reflect the committed changes.