summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-05-17 23:16:40 +0200
committerLudovic Courtès <ludo@gnu.org>2021-05-17 23:59:58 +0200
commita0ad6361670e7d3bd831e1a1920b46661a480d0a (patch)
tree8ad0b42311ad2315db18b150f08f5124b6f94c06 /guix/ui.scm
parent4288806111dd6d65a40e5e6dc915aef71810fb34 (diff)
ui: 'load*' compiles with '-O1'.
With this change, the wall-clock time of: guix system build --no-grafts -d gnu/system/install.scm goes from 5.0s to 2.3s on Guile 3.0.5. * guix/ui.scm (without-compiler-optimizations): New macro. (load*): Use it.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index a22024b62f..05b3f5f84c 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -196,6 +196,18 @@ information, or #f if it could not be found."
(stack-ref stack 1) ;skip the 'throw' frame
last))))
+(cond-expand
+ (guile-3
+ (define-syntax-rule (without-compiler-optimizations exp)
+ ;; Compile with the baseline compiler (-O1), which is much less expensive
+ ;; than -O2.
+ (parameterize (((@ (system base compile) default-optimization-level) 1))
+ exp)))
+ (else
+ (define-syntax-rule (without-compiler-optimizations exp)
+ ;; No easy way to turn off optimizations on Guile 2.2.
+ exp)))
+
(define* (load* file user-module
#:key (on-error 'nothing-special))
"Load the user provided Scheme source code FILE."
@@ -225,7 +237,8 @@ information, or #f if it could not be found."
;; search for FILE in %LOAD-PATH. Note: use 'load', not
;; 'primitive-load', so that FILE is compiled, which then allows
;; us to provide better error reporting with source line numbers.
- (load (canonicalize-path file)))
+ (without-compiler-optimizations
+ (load (canonicalize-path file))))
(const #f))))))
(lambda _
;; XXX: Errors are reported from the pre-unwind handler below, but