From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id YHD2CyZKHWYHVQEAqHPOHw:P1 (envelope-from ) for ; Mon, 15 Apr 2024 17:39:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id YHD2CyZKHWYHVQEAqHPOHw (envelope-from ) for ; Mon, 15 Apr 2024 17:39:18 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=nBKQXczg; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713195558; a=rsa-sha256; cv=none; b=H6uj8SBlMoIpDfmxpjs7nZX5zqxknFzjRaPu9ZXN1ILLFfu3DUExSXmdla2jw39tPmN18U wr6835V91kJaSWONuKwqaq+LglFz10S2DM+AUUDPyKH4oXO8FeGWCAY1zlGdBd1P358V4a AdT6FVc/Jk3xygiiGo+7BTYxwto/57shnOybDYDz9cl/y60N4CpnaK6iSTidytNeI/wsn8 PcI476lW72FORvK2b5gYu5ONwpIRZ9hlvpvkUY67GuBnua1p2bdAZNk7oweVltwuNMRLhl qDTyAPB9kIzgmAuC2EPwU3Kqog6fJKfcs4u4551Ux/OX6VJODA2UKRq+sHiy5w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=nBKQXczg; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713195558; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=tBUOkiAnBuL2QEmqfFVT8B9c4zk/02jrYmzHc66l0Og=; b=sFsh9gx0WnrhkHEoTFvi/NutYcjNZmiXcUgenA9DdeqZKFkwFW2PK9/MEizs4APTusqnjc ypVyDRKcbNf7PFYt7d3N7cRpMeiPk6M9XBkGufDMbi49oA3Hhy++DpmduL+E34CmY6lBTd elovIf66C/ZDPNpkxRlmShcsmpPMPZItu8ziFdL7XAuF8h1l9JlVWrQgj241TEo9vnDnog DH5XQW1QFK9q4OVJSz1+Pww25z/3lmvXHdG2BFzye/pmSlCNy1uD3zyVeH2EVNUbR4RnBV mfLNYmQTsMBLYj9wcCnPTGaRIzmjUNvSfJmXgNMPdUd81+RfHNv59LVJgbeyEw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9593B7DF32 for ; Mon, 15 Apr 2024 17:39:17 +0200 (CEST) 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?Q?=E2=80=98sanitize-inputs=E2=80=99.?= 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -3.07 X-Migadu-Queue-Id: 9593B7DF32 X-Migadu-Spam-Score: -3.07 X-Migadu-Scanner: mx10.migadu.com X-TUID: C7d+mP04gg5S 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 -- 2.41.0