Subject: bug#44053: ‘xdg-mime-database’ profile hook is slow

From: Ludovic Courtès <[email-masked]>
Date: Mon, 02 Nov 2020 15:04:14 +0100

Ludovic Courtès <[email-masked]> skribis:

> Ludovic Courtès <[email-masked]> skribis:
>
>> Apart from LibreOffice, I found that ‘share/mime/packages’ is provided
>> by at least: hugin, gcr, fontforge.  Most GUI packages don’t have it.
>> So in practice, we’re often rebuilding the exact same database.
>
> On closer inspection, the time-consuming bit is processing
> ‘share/mime/packages/freedesktop.org.xml’ (from ‘shared-mime-info’),
> which is quite large and leads to the creation of hundreds of file.  We
> end up re-processing it every time.  This is particularly wasteful
> because the ‘shared-mime-info’ package already contains the result of
> applying ‘update-mime-database’ to itself.

Based on these observations, I added a fast path to the
‘xdg-mime-database’ hook:

  https://git.savannah.gnu.org/cgit/guix.git/commit/?id=76ea70bd70aeb76570445c11cea2f98139192b54

It’s down to 0s in the common case where the profile doesn’t contain any
packages providing ‘share/mime/packages’.

Ludo’.