unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: zimoun <zimon.toutoune@gmail.com>
Cc: guix-devel <guix-devel@gnu.org>,
	Luis Felipe <luis.felipe.la@protonmail.com>,
	44053@debbugs.gnu.org,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#44053: ‘xdg-mime-database’ profile hook is slow
Date: Mon, 02 Nov 2020 12:12:40 +0100	[thread overview]
Message-ID: <87sg9sm2qf.fsf@gnu.org> (raw)
In-Reply-To: <87ft5zqn2a.fsf@dismail.de> (Joshua Branson's message of "Tue, 27 Oct 2020 19:14:05 -0400")

Hi,

Joshua Branson <jbranso@dismail.de> skribis:

> The "XDG MIME database" takes a while.
>
> #+BEGIN_SRC sh :results output :exports both
> time guix build --check $(guix gc -R $(guix gc --derivers $(readlink -f ~/.guix-profile)) |grep xdg-mime-database.drv)
> #+END_SRC
>
>
> #+RESULTS:
> : The following profile hook will be built:
> :    /gnu/store/lmhklgdscbfp5c6gl81skyz0azfg156m-xdg-mime-database.drv
> : building XDG MIME database...
> : successfully built /gnu/store/lmhklgdscbfp5c6gl81skyz0azfg156m-xdg-mime-database.drv
> : successfully built /gnu/store/lmhklgdscbfp5c6gl81skyz0azfg156m-xdg-mime-database.drv
> : /gnu/store/x8q8g9l0jhrpmjjm3xsh3ib1z8l79cyx-xdg-mime-database
> :
> : real	0m43.716s
> : user	0m3.626s
> : sys	0m0.258s

I found that the MIME database is computed only over the subset of the
packages in your profile that provide ‘share/mime/packages’, plus
‘shared-mime-info’.

In my profile, only LibreOffice provides that directory, so the union is
made over these two directories and that’s what ‘update-mime-database’
works on.

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.

Here’s the time taken by ‘update-mime-database’ alone:

--8<---------------cut here---------------start------------->8---
ludo@ribbon ~$ mkdir -p /tmp/mime/share/mime/packages
ludo@ribbon ~$ cd /tmp/mime/share/mime/packages
ludo@ribbon /tmp/mime/share/mime/packages$ for i in $(guix build libreoffice ^C
ludo@ribbon /tmp/mime/share/mime/packages$ for i in ~/.guix-profile/share/mime/packages/* ; do ln -s $i ; done
ludo@ribbon /tmp/mime/share/mime/packages$ ls -l
totalo 8
lrwxrwxrwx 1 ludo users 64 Nov  2 11:46 freedesktop.org.xml -> /home/ludo/.guix-profile/share/mime/packages/freedesktop.org.xml
lrwxrwxrwx 1 ludo users 60 Nov  2 11:46 libreoffice.xml -> /home/ludo/.guix-profile/share/mime/packages/libreoffice.xml
ludo@ribbon /tmp/mime/share/mime/packages$ cd /tmp/mime/
ludo@ribbon /tmp/mime$ time update-mime-database -V /tmp/mime/share/mime
Updating MIME database in /tmp/mime/share/mime...

Parsing source file /tmp/mime/share/mime/packages/freedesktop.org.xml...
Parsing source file /tmp/mime/share/mime/packages/libreoffice.xml...
Wrote 1124 strings at 2c - 6310
Wrote aliases at 6310 - 6be4
Wrote parents at 6be4 - 8468
Wrote literal globs at 8468 - 855c
Wrote suffix globs at 855c - 13514
Wrote full globs at 13514 - 13554
Wrote magic at 13554 - 2065c
Wrote namespace list at 2065c - 20798
Wrote icons list at 20798 - 2079c
Wrote generic icons list at 2079c - 213b8
Wrote types list at 213b8 - 22020

Note that '/tmp/mime/share' is not in the search path
set by the XDG_DATA_HOME and XDG_DATA_DIRS
environment variables, so applications may not
be able to find it until you set them. The
directories currently searched are:

- /home/ludo/.local/share
- /home/ludo/.guix-profile/share
- /run/current-system/profile/share
- /home/ludo/.guix-profile/share
- /run/current-system/profile/share


real    0m2.166s
user    0m0.278s
sys     0m0.056s
--8<---------------cut here---------------end--------------->8---

To be compared with:

--8<---------------cut here---------------start------------->8---
$ drv="$(guix gc -R $(guix gc --derivers $(readlink -f ~/.guix-profile)) |grep xdg-mime-database.drv)"
$ time guix build --check $drv
The following profile hook will be built:
   /gnu/store/jrmwsxpz3wmq37zx29lvb0r9nvcmdviz-xdg-mime-database.drv
building XDG MIME database...
successfully built /gnu/store/jrmwsxpz3wmq37zx29lvb0r9nvcmdviz-xdg-mime-database.drv
/gnu/store/npvj2sr9kxx48znh7zc8zmzwzs6brc90-xdg-mime-database

real    0m3.670s
user    0m1.428s
sys     0m0.029s
--8<---------------cut here---------------end--------------->8---

Thus, the build time itself is entirely taken by ‘update-mime-database’
(the 1.4s above is “overhead” in ‘guix build’ it would seem).

Ludo’.




  reply	other threads:[~2020-11-02 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87o8l7pple.fsf@gnu.org>
     [not found] ` <sqv1qTRO4PZuOuanFOc1Dw6QlIMeczAQjg9erpoU9CmuWjuqYl7H87lpEfl7w2zNAT755yE_djMRXz8fKFiXZ8ddUJSdtLkSCoWIl9KREnw=@protonmail.com>
     [not found]   ` <87h7qxhncq.fsf@gnu.org>
     [not found]     ` <3aQjRn5jGhxHrhAmuB3MfLRjSxAp3PVFu1vL7_GV1ucGibzYURCtMqHN4oeyGb5xez2xYM3loEJIECrVdnAGZBZvf0N1bGXN-80mO6Ymr6k=@protonmail.com>
     [not found]       ` <87sgagv8qt.fsf@dismail.de>
     [not found]         ` <87o8l279eb.fsf@gnu.org>
     [not found]           ` <CAJ3okZ3DR0qDq5qwY-ZBboBUFcCnv5bAYR8RuUSW0dSj8SRyyA@mail.gmail.com>
     [not found]             ` <4JD1z15e92ccv6WXcMS5IiNJnDwR6P3bkIwtPWLUPYDVCUHYDoekpifyj3GQtnEq1LCKftbL-FV1hp162A1mid2EmjLMbWlxQ05aE9vGyf0=@protonmail.com>
     [not found]               ` <87v9f842uu.fsf@gmail.com>
     [not found]                 ` <CAJ3okZ2WTcZ+JLYUCEcU6CESpOOjHcdFEWirSOCfrZFbXeLzAg@mail.gmail.com>
     [not found]                   ` <87v9f7gspm.fsf@dismail.de>
     [not found]                     ` <874kmn9adz.fsf_-_@gnu.org>
2020-10-27 23:14                       ` bug#44053: ‘xdg-mime-database’ profile hook is slow Joshua Branson via Bug reports for GNU Guix
2020-11-02 11:12                         ` Ludovic Courtès [this message]
     [not found]                           ` <87ft5rncn5.fsf@gnu.org>
     [not found]                             ` <86blgeggo8.fsf@gmail.com>
     [not found]                               ` <wfCkfOh1kZkBBqR2DYrffbz9xGwrXpB5lNfNNbLywaXO2i620ONaFST7pkyF_vskC20eUnLuV36YyO6t8v6__7oyVbOzaCoba1muCHDP0S4=@protonmail.com>
2020-11-06  9:10                                 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sg9sm2qf.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=44053@debbugs.gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=luis.felipe.la@protonmail.com \
    --cc=maxim.cournoyer@gmail.com \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).