Subject: Re: bug#47496: Very slow `guix environment -l nyxt/build-scripts/guix.scm

From: Ludovic Courtès <[email-masked]>
Date: Fri, 02 Apr 2021 09:43:17 +0200

Hi Pierre,

Pierre Neidhardt <[email-masked]> skribis:

> Nyxt provides a "guix.scm" to build Nyxt locally:
>
> https://github.com/atlas-engineer/nyxt/blob/3239b10d816861d329dce10863cb84f9d0bd76ed/build-scripts/guix.scm
>
> A few weeks ago (not sure exactly when and why), `guix environment -l
> guix.scm` started being extremely slow.
>
> By this, I mean that
>
> $ guix environment -v 99 --pure --load=build-scripts/guix.scm 

On a warm cache, I get:

--8<---------------cut here---------------start------------->8---
$ time guix environment -l /tmp/nyxt/build-scripts/guix.scm -v2 -n -- true
22.0 MB would be downloaded:
   /gnu/store/1dr7bkhy8f2v0kgpgm4swl0zrr740zwk-cl-webkit-2.4-10.0bc05cc
   /gnu/store/bpw4k590597g0n7n868qhlsf2cnclzl0-webkitgtk-2.30.6-doc
   /gnu/store/j67y7mzb5dyaqln90n3is85nz218bvxp-webkitgtk-2.30.6

real	0m6.060s
user	0m7.152s
sys	0m0.175s
$ time guix environment -l /tmp/nyxt/build-scripts/guix.scm -v2 -n --no-grafts -- true
La jena derivo estus konstruata:
   /gnu/store/apk1g220mh4g2fzddxy28ssmk6fy9wbm-profile.drv
0.0 MB would be downloaded:
   /gnu/store/1dr7bkhy8f2v0kgpgm4swl0zrr740zwk-cl-webkit-2.4-10.0bc05cc
The following profile hooks would be built:
   /gnu/store/3qhdrwww3yidqk6w98md9w4yfqv7sx4l-xdg-desktop-database.drv
   /gnu/store/7dnznrkrn5rajf60gfj0kvkgz5bylkdc-xdg-mime-database.drv
   /gnu/store/86df5c3j48wg59yrrcqya1rskmwbqjqb-gtk-im-modules.drv
   /gnu/store/9xjd6ax9hlmskhyagf46l28258azra0s-ca-certificate-bundle.drv
   /gnu/store/bb583drg33kg138fb25cb0zd7hhgxzw2-glib-schemas.drv
   /gnu/store/gw13b4ivyfzzvpdik3mgghx6n4ql8b6h-info-dir.drv
   /gnu/store/p2srmzy6b08x7gbg8nvmxzrr6ypsrqiq-gtk-icon-themes.drv
   /gnu/store/p3l0f5imh4021khfrnaqgk0xl5w5zmnh-fonts-dir.drv
   /gnu/store/wsryc95x85d0qdavgiw4fy1qglam6b84-manual-database.drv

real	0m4.497s
user	0m5.719s
sys	0m0.151s
$ guix describe
Generacio 179	Mar 30 2021 11:00:56	(nuna)
  guix 9098745
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 9098745b181b3022587a35afd255f7ff1d41ac86
--8<---------------cut here---------------end--------------->8---

That’s still too long.  The graft performance problem is what’s
discussed at <https://issues.guix.gnu.org/41702>.  The ‘--no-grafts’
performance is not great either, and I wonder if it’s suboptimal
behavior in the presence of many propagated inputs.

> Something must be wrong, because I found a workaround that's fishy: if I
> comment out some inputs from the guix.scm and build the environment,
> then it works.  Then I uncomment the commented inputs and this time the
> environment builds in a few seconds.

There was temporarily a performance regression regarding substitutes:

  https://issues.guix.gnu.org/47283

Given what you describe, this sounds like a likely culprit.  Would be
nice to see if after updating your daemon you still experience that kind
of behavior.

HTH,
Ludo’.