[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/29: gexp: Micro-optimize 'gexp->sexp' and 'lower-inputs'.
From: |
guix-commits |
Subject: |
09/29: gexp: Micro-optimize 'gexp->sexp' and 'lower-inputs'. |
Date: |
Mon, 8 Mar 2021 06:24:50 -0500 (EST) |
civodul pushed a commit to branch wip-build-systems-gexp
in repository guix.
commit ee5bc904bc92b5d19f6c7cd3b33ecd61dad94c3f
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Feb 17 14:25:43 2021 +0100
gexp: Micro-optimize 'gexp->sexp' and 'lower-inputs'.
* guix/gexp.scm (lower-inputs, gexp->sexp): Change keyword parameters to
positional parameters. Adjust callers accordingly.
* tests/gexp.scm (gexp->sexp*, "gexp->file"): Adjust accordingly.
---
guix/gexp.scm | 20 ++++++--------------
tests/gexp.scm | 5 ++---
2 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 058819b..00570a8 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -826,8 +826,7 @@ list."
(one-of symbol? string? keyword? pair? null? array?
number? boolean? char?)))
-(define* (lower-inputs inputs
- #:key system target)
+(define (lower-inputs inputs system target)
"Turn any object from INPUTS into a derivation input for SYSTEM or a store
item (a \"source\"); return the corresponding input list as a monadic value.
When TARGET is true, use it as the cross-compilation target triplet."
@@ -874,8 +873,7 @@ corresponding <derivation-input> or store item."
(match graphs
(((file-names . inputs) ...)
(mlet %store-monad ((inputs (lower-inputs (map tuple->gexp-input inputs)
- #:system system
- #:target target)))
+ system target)))
(return (map cons file-names inputs))))))
(define* (lower-references lst #:key system target)
@@ -1005,11 +1003,8 @@ derivations--e.g., code evaluated for its side effects."
(return guile-for-build)
(default-guile-derivation system)))
(inputs (lower-inputs (gexp-inputs exp)
- #:system system
- #:target target))
- (sexp (gexp->sexp exp
- #:system system
- #:target target))
+ system target))
+ (sexp (gexp->sexp exp system target))
(extensions -> (gexp-extensions exp))
(exts (mapm %store-monad
(lambda (obj)
@@ -1278,9 +1273,7 @@ The other arguments are as for 'derivation'."
(delete-duplicates
(add-reference-output (gexp-references exp) '())))
-(define* (gexp->sexp exp #:key
- (system (%current-system))
- (target (%current-target-system)))
+(define (gexp->sexp exp system target)
"Return (monadically) the sexp corresponding to EXP for the given OUTPUT,
and in the current monad setting (system type, etc.)"
(define* (reference->sexp ref #:optional native?)
@@ -1293,8 +1286,7 @@ and in the current monad setting (system type, etc.)"
(return `((@ (guile) getenv) ,output)))
(($ <gexp-input> (? gexp? exp) output n?)
(gexp->sexp exp
- #:system system
- #:target (if (or n? native?) #f target)))
+ system (if (or n? native?) #f target)))
(($ <gexp-input> (refs ...) output n?)
(mapm %store-monad
(lambda (ref)
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 0bd1237..a30d0ff 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -57,8 +57,7 @@
(apply (@@ (guix gexp) gexp->sexp) x))
(define* (gexp->sexp* exp #:optional target)
- (run-with-store %store (gexp->sexp exp
- #:target target)
+ (run-with-store %store (gexp->sexp exp (%current-system) target)
#:guile-for-build (%guile-for-build)))
(define (gexp-input->tuple input)
@@ -540,7 +539,7 @@
(test-assertm "gexp->file"
(mlet* %store-monad ((exp -> (gexp (display (ungexp %bootstrap-guile))))
(guile (package-file %bootstrap-guile))
- (sexp (gexp->sexp exp))
+ (sexp (gexp->sexp exp (%current-system) #f))
(drv (gexp->file "foo" exp))
(out -> (derivation->output-path drv))
(done (built-derivations (list drv)))
- branch wip-build-systems-gexp created (now 61e9041), guix-commits, 2021/03/08
- 03/29: serialization: Micro-optimize string literal output in 'write-file-tree'., guix-commits, 2021/03/08
- 04/29: grafts: Inline 'grafting?' and 'set-grafting'., guix-commits, 2021/03/08
- 08/29: gexp: Keep 'lower-inputs' private., guix-commits, 2021/03/08
- 01/29: store: Object cache profiling shows the number of entries., guix-commits, 2021/03/08
- 06/29: gexp: 'gexp-inputs' returns a list of <gexp-input> records., guix-commits, 2021/03/08
- 07/29: gexp: 'gexp-inputs' returns both native and non-native inputs., guix-commits, 2021/03/08
- 11/29: gexp: Reduce allocations in 'gexp-attribute'., guix-commits, 2021/03/08
- 09/29: gexp: Micro-optimize 'gexp->sexp' and 'lower-inputs'.,
guix-commits <=
- 13/29: gexp: Optimize 'with-build-variables'., guix-commits, 2021/03/08
- 10/29: gexp: Reduce allocations while traversing lists., guix-commits, 2021/03/08
- 20/29: build-system: Use 'sexp->gexp' for plain sexps., guix-commits, 2021/03/08
- 21/29: build-system: Use 'input-tuples->gexp' and 'outputs->gexp'., guix-commits, 2021/03/08
- 02/29: store: Micro-optimize object cache lookup., guix-commits, 2021/03/08
- 28/29: grafts: Add 'without-grafting'., guix-commits, 2021/03/08
- 29/29: gexp: Allowed/disallowed references and graphs never refer to grafted inputs., guix-commits, 2021/03/08
- 14/29: build-system: Rewrite using gexps., guix-commits, 2021/03/08
- 15/29: packages: Turn 'bag->derivation' into a monadic procedure., guix-commits, 2021/03/08
- 16/29: packages: Simplify patch instantiation., guix-commits, 2021/03/08