guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Optimizing profile creation


From: Ludovic Courtès
Subject: Optimizing profile creation
Date: Mon, 02 Sep 2013 23:14:27 +0200
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]