Plugin locator performance ballpark
David Faure
faure at kde.org
Sun Sep 8 09:17:56 UTC 2013
On Thursday 05 September 2013 01:04:52 Sebastian Kügler wrote:
> Reading just $PLUGINS/kf5, 52 plugins
> 21893.0 microsec (KServiceTypeTrader)
> 95835.0 microsec (Metadata)
> --> Reading metadata is 4-5 slower, ~100ms
>
> Reading $PLUGINS recursively, 127 plugins
> 20180.0 microsec (KServiceTypeTrader)
> 347083.0 microsec (Metadata)
> --> Expectedly, gets worse with more plugins, ~300ms
This is why I think we want an API that is slightly different from
KServiceTypeTrader: we want a subdir name into which to narrow the search.
Queries for calligra plugins should only look in $PLUGINS/kf5/calligra/
Queries for KCModules should only look in $PLUGINS/kf5/kcmodules/
Queries for kio_thumbnail plugins should only look in
$PLUGINS/kf5/thumbcreator/
etc.
i.e. turning every "service type" into a subdir name. But for more complex
cases (e.g. a plugin implementing multiple servicetypes) we can still use
additional constraints in the metadata of course.
Querying into a plugins subdir is more Qt-like, too.
However Boud said calligra had 300-400 plugins, so under calligra alone we'd
have the same performance as what you just measured for all of $PLUGINS/kf5.
300 ms cold cache, 16 ms warm cache. Boud, any opinions? :-)
The alternative is a cache for all plugins under $PLUGINS/kf5. More ksycoca-
like in terms of API. But then I'd want the cache to be updated on make
install instead (like shared-mime-info). If you're going this road, I have
stuff to show you for inspiration (the similar cache for app desktop files,
that Ryan Lortie and I designed at the freedesktop summit).
PS: staging/ktextwidgets/src/findreplace/kfinddialog.cpp uses
KServiceTypeTrader to locate the kregexpeditor plugin, do we agree that it
could just look it up by name, e.g. kf5/kregexpeditorgui.so?
Then ktextwidgets could drop the dependency on KService.
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
More information about the Kde-frameworks-devel
mailing list