revisiting the sycoca

Matthias Klumpp matthias at tenstral.net
Thu Feb 8 17:04:12 GMT 2024


Hi!

Am Do., 8. Feb. 2024 um 15:22 Uhr schrieb Harald Sitter <sitter at kde.org>:
>
> It occurs to me that we should ponder sycoca a bit.
>
> Currently the sycoca contains 3 types of caches:
>
> - the mime cache: should in fact be unnecessary because there is
> already a mime.cache in /usr/share/mime?

That cache is used by pretty much everything on Linux, including Qt
itself as far as I know.
I do wonder though whether there is any performance impact when the
user changes/overrides a mime association and whether that is what the
sycoca cache handles? Even if that is the case, there should be a much
better way to deal with this.

> - the menu structure cache: for the most part only loaded once by
> plasmashell so the caching seems a bit questionable (caveat: kopenwith
> also uses the menu structure)

Hmm, we'd have to measure this, but I seriously doubt that we still
need this cache, as that data is parsed super quickly - and only
rarely even needs to be parsed multiple times.

> - the applications desktop file cache: with most metadata having moved
> to json, the desktop file caching sycoca offers seems not particularly
> useful any longer as it is basically just caching
> /usr/share/applications and variants thereof. In practice we have very
> few apps that actually start other apps (notably plasmashell) so they
> could just always hold the desktop files in memory and refresh on
> inotifies. There is also a new-ish mimeinfo.cache which we can hold on
> to.

Indeed, using %prefix/share/applications/mimeinfo.cache should result
in the most performance benefit for determining which app can support
what mimetypes quickly, and I don't think the rest needs a lot of
caching.
The thing that benefits the most from caches by far is caching icons
and rendered SVG images from themes, and that isn't handled by sycoca.

> All in all I am not convinced we still need the sycoca. Indeed one
> huge question is why we are holding on to a bespoke cache. If files
> need caching then shouldn't we cache them on an xdg level? There is of
> course also the point that nobody else seems to need them cached,
> calling the sycoca yet more into question.

Agreed :-)

> With all that in mind... how about we deprecated the sycoca? It'd
> shave some 5k lines off of kservice in the long run.

I think that would make a lot of sense at this point, actually :-)

Best,
    Matthias

-- 
I welcome VSRE emails. See http://vsre.info/


More information about the kde-core-devel mailing list