On Sun, 8 Sep 2013, David Faure wrote:

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? :-)

I like the directoryname idea, and actually, I'd go for a hierarchy:

calligra/filter
calligra/parts
calligra/words
calligra/krita/paintop
calligra/krita/filter
calligra/krita/extensions

etcetera. that should limit the number of plugins per directory to something like 30, 40 maximum (for krita/extensions).


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, fa...@kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5

_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel

Reply via email to