aboutsummaryrefslogtreecommitdiff
path: root/guix/channels.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-04-12 18:33:17 +0200
committerLudovic Courtès <ludo@gnu.org>2021-04-12 18:44:09 +0200
commita514b4ab19a628cbfa8b6d7c316ed7242018fcbf (patch)
treec05b5a6b7f2ad24b95c849289fc4bd03b79ff3f0 /guix/channels.scm
parent4d0d6d86263f0701244682e2226c8b539b25f669 (diff)
downloadguix-a514b4ab19a628cbfa8b6d7c316ed7242018fcbf.tar
guix-a514b4ab19a628cbfa8b6d7c316ed7242018fcbf.tar.gz
channels: Build user channels with '-O1'.
This should noticeably speed up compilation for channels with many files. * guix/channels.scm (standard-module-derivation)[build]: Define 'optimizations-for-level' and '-O1'. Pass #:optimization-options to 'compile-files'.
Diffstat (limited to 'guix/channels.scm')
-rw-r--r--guix/channels.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/guix/channels.scm b/guix/channels.scm
index b812c1b6e5..c40fc0c507 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -597,9 +597,24 @@ to '%package-module-path'."
(string-append #$output "/share/guile/site/"
(effective-version)))
+ (define optimizations-for-level
+ ;; Guile 3.0 provides this procedure but Guile 2.2 didn't.
+ ;; Since this code may be executed by either version, we can't
+ ;; rely on its availability.
+ (or (and=> (false-if-exception
+ (resolve-interface '(system base optimize)))
+ (lambda (iface)
+ (module-ref iface 'optimizations-for-level)))
+ (const '())))
+
+ (define -O1
+ ;; Optimize for package module compilation speed.
+ (optimizations-for-level 1))
+
(let* ((subdir #$directory)
(source (string-append #$source subdir)))
- (compile-files source go (find-files source "\\.scm$"))
+ (compile-files source go (find-files source "\\.scm$")
+ #:optimization-options (const -O1))
(mkdir-p (dirname scm))
(symlink (string-append #$source subdir) scm))