GNU bug report logs - #70398
[PATCH 0/5] Reduce the size of gnu/packages/*.go files

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Mon, 15 Apr 2024 15:29:03 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: 70398 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>, Christopher Baines <guix <at> cbaines.net>, Josselin Poiret <dev <at> jpoiret.xyz>, Ludovic Courtès <ludo <at> gnu.org>, Mathieu Othacehe <othacehe <at> gnu.org>, Ricardo Wurmus <rekado <at> elephly.net>, Simon Tournier <zimon.toutoune <at> gmail.com>, Tobias Geerinckx-Rice <me <at> tobias.gr>
Subject: [bug#70398] [PATCH 5/5] packages: Reduce code bloat due to list allocation in input fields.
Date: Mon, 15 Apr 2024 17:37:07 +0200
* guix/packages.scm (add-input-labels): New procedure.
(sanitize-inputs): Add case for (list …).

Change-Id: Ice8241508ded51efd38867b97ca19c262b8c4363
---
 guix/packages.scm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/guix/packages.scm b/guix/packages.scm
index 6c697bcc67..3a4f547d6b 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -439,16 +439,26 @@ (define (maybe-add-input-labels inputs)
          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)
-- 
2.41.0





This bug report was last modified 1 year and 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.