From patchwork Mon Apr 15 15:37:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 63054 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9B48F27BBEB; Mon, 15 Apr 2024 16:39:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 17D9527BBE9 for ; Mon, 15 Apr 2024 16:39:17 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwOQ6-0006Jm-8a; Mon, 15 Apr 2024 11:38:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwOQ4-0006J3-P5 for guix-patches@gnu.org; Mon, 15 Apr 2024 11:38:56 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwOQ4-0001dw-GT; Mon, 15 Apr 2024 11:38:56 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwOQE-00081H-Tk; Mon, 15 Apr 2024 11:39:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70398] [PATCH 2/5] packages: Reduce bloat induced by =?utf-8?b?4oCYc2FuaXRpemUtaW5wdXRz4oCZLg==?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 15 Apr 2024 15:39:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 70398-submit@debbugs.gnu.org id=B70398.171319550530464 (code B ref 70398); Mon, 15 Apr 2024 15:39:06 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 15:38:25 +0000 Received: from localhost ([127.0.0.1]:37906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwOPX-0007uo-5S for submit@debbugs.gnu.org; Mon, 15 Apr 2024 11:38:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwOPG-0007q5-Qe for 70398@debbugs.gnu.org; Mon, 15 Apr 2024 11:38:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwOOx-0001Tr-Mf; Mon, 15 Apr 2024 11:37:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=tBUOkiAnBuL2QEmqfFVT8B9c4zk/02jrYmzHc66l0Og=; b=nBKQXczgh9v3c+MQc324 IjkMC80tPsVmIbhMAuoowimD9M4FZv2H2t+RLIdF7pdbeNZnw0N886BW+76c30VnAmhwH+JLyXCBX hS7l62jVFW8POunlSt5qSIOwOxvWrpNeyLrhIix8LFHNwDklAe1OLZYvCnt7Oc4K7ngCXrHcPlEN5 L4hy54zerPC1mw7LXG0NtsyostsGTR0yY0PZdGwKn8SIVTm0saYWAb0XtZZHaFH1mzmS1peNI2TcC 5EF0CZJg4gX/mRVRHT6q1LFs2izhhqfv3Xr/LX9bnjSOiKR26Quh/9vRwRV9Krmd54R20rQXgoqAA zTMkwwGVniYNqg==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 15 Apr 2024 17:37:04 +0200 Message-ID: <5668e959834c21809c42c1556359eb65bf285caf.1713194148.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches At -O1, peval does the bulk of the optimization work and it cannot reduce things like (null? (list 1 2)), unlike what happens in CPS at -O2. Thus, reduce the part of ‘sanitize-inputs’ that’s inlined. * guix/packages.scm (maybe-add-input-labels): New procedure. (sanitize-inputs): Turn into a macro; use ‘maybe-add-input-labels’. Change-Id: Id2283bb5a2f5d714722200bdcfe0b0bfa606923f --- guix/packages.scm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index 930b1a3b0e..bd6724cdd4 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012-2023 Ludovic Courtès +;;; Copyright © 2012-2024 Ludovic Courtès ;;; Copyright © 2014, 2015, 2017, 2018, 2019 Mark H Weaver ;;; Copyright © 2015 Eric Bavier ;;; Copyright © 2016 Alex Kost @@ -430,15 +430,26 @@ (define %cuirass-supported-systems ;; . (fold delete %supported-systems '("mips64el-linux" "powerpc-linux" "riscv64-linux"))) -(define-inlinable (sanitize-inputs inputs) - "Sanitize INPUTS by turning it into a list of name/package tuples if it's -not already the case." - (cond ((null? inputs) inputs) +(define (maybe-add-input-labels inputs) + "Add labels to INPUTS unless it already has them." + (cond ((null? inputs) + inputs) ((and (pair? (car inputs)) (string? (caar inputs))) inputs) (else (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) + "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)))) + (define-syntax current-location-vector (lambda (s) "Like 'current-source-location' but expand to a literal vector with