summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-04-14 16:13:01 +0200
committerLudovic Courtès <ludo@gnu.org>2024-05-04 19:14:25 +0200
commit402d0a9b9d290a2e3c549932c8d7262622c58ce1 (patch)
treee239223686b2c0cdc26f3e5b6209acd84175bfee
parent76127069e0221a603f880a950ba0fb42a499be3d (diff)
downloadguix-patches-402d0a9b9d290a2e3c549932c8d7262622c58ce1.tar
guix-patches-402d0a9b9d290a2e3c549932c8d7262622c58ce1.tar.gz
packages: Reduce code bloat due to list allocation in input fields.
* guix/packages.scm (add-input-labels): New procedure. (sanitize-inputs): Add case for (list …). Change-Id: Ice8241508ded51efd38867b97ca19c262b8c4363
-rw-r--r--guix/packages.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index cd5df9130b..4385e4f930 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -438,16 +438,26 @@ from forcing GEXP-PROMISE."
inputs)
(else (map add-input-label inputs))))
+(define (add-input-labels . inputs)
+ "Add labels to all of INPUTS."
+ (map add-input-label inputs))
+
(define-syntax sanitize-inputs
;; This is written as a macro rather than as a 'define-inlinable' procedure
;; because as of Guile 3.0.9, peval can handle (null? '()) but not
;; (null? (list x y z)); that residual 'null?' test contributes to code
;; bloat.
- (syntax-rules (quote)
+ (syntax-rules (quote list)
"Sanitize INPUTS by turning it into a list of name/package tuples if it's
not already the case."
((_ '()) '())
- ((_ inputs) (maybe-add-input-labels inputs))))
+ ((_ (list args ...))
+ ;; As of 3.0.9, (list ...) is open-coded, which can lead to a long list
+ ;; of instructions. To reduce code bloat in package modules where input
+ ;; fields may create such lists, move list allocation to the callee.
+ (add-input-labels args ...))
+ ((_ inputs)
+ (maybe-add-input-labels inputs))))
(define-syntax current-location-vector
(lambda (s)