unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guix-devel@gnu.org
Subject: Optimizing profile creation
Date: Mon, 02 Sep 2013 23:14:27 +0200	[thread overview]
Message-ID: <874na33ozw.fsf@gnu.org> (raw)

At the GHM, Andreas rightfully noted that building a profile with many
files, as is the case when TeX Live is installed, can take quite a bit
of time; and every time a package is installed/removed/upgraded, you pay
that price again since the profile is built from scratch.

Creating a profile builds a symlink forest that is the union of all the
package directories that make up the profile.  But with a package like
TeX Live, until now, this would end up traversing all of its ‘texmf’
sub-directory, just to create a symlink forest that copies the ‘texmf’
directory structure.

So, commit 43dd920 does the (now obvious) optimization: if a
sub-directory, like ‘texmf’, is only in one package, then it symlinks
that directory without traversing it.

This happens to be a quite frequent situation.  For instance, with Emacs
in my profile, I would before have this:

--8<---------------cut here---------------start------------->8---
$ ls -l /nix/var/nix/profiles/per-user/ludo/guix-profile-104-link/share/emacs/
total 16
dr-xr-xr-x 6 root nixbld  4096 Jan  1  1970 24.3/
dr-xr-xr-x 3 root nixbld 12288 Jan  1  1970 site-lisp/

$ ls -l /nix/var/nix/profiles/per-user/ludo/guix-profile-104-link/share/emacs/24.3/lisp/
total 2096
lrwxrwxrwx 1 nixbld1 nixbld    87 Jan  1  1970 abbrev.elc -> /nix/store/f3pxa96mg8ws4kfldzarayd8i58ddz5j-emacs-24.3/share/emacs/24.3/lisp/abbrev.elc
lrwxrwxrwx 1 nixbld1 nixbld    89 Jan  1  1970 abbrev.el.gz -> /nix/store/f3pxa96mg8ws4kfldzarayd8i58ddz5j-emacs-24.3/share/emacs/24.3/lisp/abbrev.el.gz
lrwxrwxrwx 1 nixbld1 nixbld    86 Jan  1  1970 align.elc -> /nix/store/f3pxa96mg8ws4kfldzarayd8i58ddz5j-emacs-24.3/share/emacs/24.3/lisp/align.elc
lrwxrwxrwx 1 nixbld1 nixbld    88 Jan  1  1970 align.el.gz -> /nix/store/f3pxa96mg8ws4kfldzarayd8i58ddz5j-emacs-24.3/share/emacs/24.3/lisp/align.el.gz
[...]
--8<---------------cut here---------------end--------------->8---

With this optimization, I have directly this:

--8<---------------cut here---------------start------------->8---
$ ls -l /nix/var/nix/profiles/per-user/ludo/guix-profile-105-link/share/emacs/
total 16
lrwxrwxrwx 1 nixbld1 nixbld    71 Jan  1  1970 24.3 -> /nix/store/f3pxa96mg8ws4kfldzarayd8i58ddz5j-emacs-24.3/share/emacs/24.3/
dr-xr-xr-x 2 root    nixbld 12288 Jan  1  1970 site-lisp/
--8<---------------cut here---------------end--------------->8---

No need to traverse the crowded ‘24.3’ directory since there’s only one
package in my profile that provides it.

Please report any speedups or bugs you may have.  :-)

Ludo’.

             reply	other threads:[~2013-09-02 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-02 21:14 Ludovic Courtès [this message]
2013-09-03 15:51 ` Optimizing profile creation Andreas Enge

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=874na33ozw.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    /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).