X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 0/5] Reduce the size of gnu/packages/*.go files Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 15:29:03 +0000 Resent-Message-ID: <handler.70398.B.171319490425275 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398 <at> debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> X-Debbugs-Original-To: guix-patches@HIDDEN X-Debbugs-Original-Xcc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Received: via spool by submit <at> debbugs.gnu.org id=B.171319490425275 (code B ref -1); Mon, 15 Apr 2024 15:29:03 +0000 Received: (at submit) by debbugs.gnu.org; 15 Apr 2024 15:28:24 +0000 Received: from localhost ([127.0.0.1]:37820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwOFm-0006Yn-JW for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:28:23 -0400 Received: from lists.gnu.org ([2001:470:142::17]:41118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1rwOFe-0006WP-H2 for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:28:14 -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 <ludo@HIDDEN>) id 1rwOFJ-0003y2-Rq for guix-patches@HIDDEN; Mon, 15 Apr 2024 11:27:51 -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 <ludo@HIDDEN>) id 1rwOFJ-0008D1-Im; Mon, 15 Apr 2024 11:27:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=1L4kkuE/4SdugaIqHE3X4BsGqWFLTdC9ewEbqqXRPJg=; b=ODHFKCdZg1ohFA p0jcq9xpL7u6M3md3IOtn5mDShABJmdfebQOi6acC0QJtqhSuPgO3c3qT5Pgs9IWi/ln6v2qHmRz8 o3cVdxV5clH8psZ7zwWABR/MnRGp+r0i5JUri48nnzleuG4RRZA3q3nsvaY5jxJ/zyErSMmc5o+HZ iVDUdBWl4VFQxpEfdlBnFOkI6cN8HD2kCJqELCWu01URo+FckCROYhDeg72exvKVHvd4Mf9lFGm51 BS59qFdPEfs/DlppgtEAoGTHyDJAAmhFeiIR2wjczIvloEWxEZ7HbEl1GZ6mr7K+UKETv6Aj20K1F oUM4ill+pgAumYFMxK1w==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Date: Mon, 15 Apr 2024 17:27:36 +0200 Message-ID: <cover.1713194148.git.ludo@HIDDEN> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello! As a followup to <https://issues.guix.gnu.org/70280>, I started looking into the size of Guix itself, and in particular that of gnu/packages/*.go files. What follows is a bunch of tricks to reduce code bloat, achieving ~14% reduction in the size of .go files (~18% if we look at gnu/packages alone). About 60% of those files are in the 64–128 KiB range. Since ELF sections are currently 64 KiB-aligned (see ‘*lcm-page-size*’ in Guile), we would save space by ensuring these are sparse files. To do that, we’ll need to detect holes when restoring nars and/or to change the nar format to preserve holes, while also ensuring that when the daemon copies files around, it also preserves holes. Work for later! Thoughts? Ludo’. Ludovic Courtès (5): records: Do not inline throws for ABI mismatches. packages: Reduce bloat induced by ‘sanitize-inputs’. records: Do not inline the constructor. packages: ‘define-public’ replacement calls ‘module-export!’ directly. packages: Reduce code bloat due to list allocation in input fields. guix/packages.scm | 53 +++++++++++++++++++++++++++++++++++-------- guix/records.scm | 58 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 83 insertions(+), 28 deletions(-) base-commit: cd45294d576975a3bff2f755764a3f46f09ea6f9 -- 2.41.0
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Subject: bug#70398: Acknowledgement ([PATCH 0/5] Reduce the size of gnu/packages/*.go files) Message-ID: <handler.70398.B.171319490425275.ack <at> debbugs.gnu.org> References: <cover.1713194148.git.ludo@HIDDEN> X-Gnu-PR-Message: ack 70398 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 70398 <at> debbugs.gnu.org Date: Mon, 15 Apr 2024 15:29:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. As you requested using X-Debbugs-CC, your message was also forwarded to Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>,= Ludovic Court=C3=A8s <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, = Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN= om>, Tobias Geerinckx-Rice <me@HIDDEN> (after having been given a bug report number, if it did not have one). Your message has been sent to the package maintainer(s): guix-patches@HIDDEN If you wish to submit further information on this problem, please send it to 70398 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 70398: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D70398 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 1/5] records: Do not inline throws for ABI mismatches. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 15:39:02 +0000 Resent-Message-ID: <handler.70398.B70398.171319549230315 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398 <at> debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> X-Debbugs-Original-Xcc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171319549230315 (code B ref 70398); Mon, 15 Apr 2024 15:39:02 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 15:38:12 +0000 Received: from localhost ([127.0.0.1]:37900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwOPI-0007s0-BG for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:38:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1rwOPE-0007pw-TS for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:38:06 -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 <ludo@HIDDEN>) id 1rwOOw-0001Tq-MX; 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=EXkmOYq5C91w+rjqInPiIAPtMC1u/Ul7/eM3xbS+R04=; b=A8fPfDUYuwSzjAJXp8yN mdqlPMtnExmgwydCqqNrIVYH8JXBIzUnIjN69VbT0TcM6dpBQoZx8++b9j5Ny2j065jMbp4QOcchP JzBZBC3f8KuVx9xxg+mcobMSzQ3M+SYjQMx8tuU10tB1k03DSYi1jFeA9vbbGRQeyPmOXEhcniC5J A6DEVT9aOXgJs6koya+jiIXJTENq0r+ZC127FmVE1S/QNxuAPWX0CVAGvPgau6hVm+uff42Jvszc1 wUTjoK/kgwjBNlGuJyVST0e6siw2O7I95evtW5JIgNtf6TdS9wXiYngzAw1747KiFX4cbOenqcORV DFUuBbSwvdsgZA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Date: Mon, 15 Apr 2024 17:37:03 +0200 Message-ID: <a169679444f30d2d10c71438a00167c857ca50ef.1713194148.git.ludo@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <cover.1713194148.git.ludo@HIDDEN> References: <cover.1713194148.git.ludo@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) * guix/records.scm (record-abi-mismatch-error): New procedure. (abi-check): Use it. Change-Id: I49936599716e117b8fbf26fb9d8f462bbbb8e88b --- guix/records.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/guix/records.scm b/guix/records.scm index f4d12a861d..48637ea0a4 100644 --- a/guix/records.scm +++ b/guix/records.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012-2023 Ludovic Courtès <ludo@HIDDEN> +;;; Copyright © 2012-2024 Ludovic Courtès <ludo@HIDDEN> ;;; Copyright © 2018 Mark H Weaver <mhw@HIDDEN> ;;; ;;; This file is part of GNU Guix. @@ -61,6 +61,11 @@ (define-syntax record-error (string-append "% " (symbol->string type-name) " abi-cookie"))))) + (define (record-abi-mismatch-error type) + (throw 'record-abi-mismatch-error 'abi-check + "~a: record ABI mismatch; recompilation needed" + (list type) '())) + (define (abi-check type cookie) "Return syntax that checks that the current \"application binary interface\" (ABI) for TYPE is equal to COOKIE." @@ -68,9 +73,7 @@ (define-syntax record-error #`(unless (eq? current-abi #,cookie) ;; The source file where this exception is thrown must be ;; recompiled. - (throw 'record-abi-mismatch-error 'abi-check - "~a: record ABI mismatch; recompilation needed" - (list #,type) '())))) + (record-abi-mismatch-error #,type)))) (define* (report-invalid-field-specifier name bindings #:optional parent-form) -- 2.41.0
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 3/5] records: Do not inline the constructor. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 15:39:02 +0000 Resent-Message-ID: <handler.70398.B70398.171319550130407 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398 <at> debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> X-Debbugs-Original-Xcc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171319550130407 (code B ref 70398); Mon, 15 Apr 2024 15:39:02 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 15:38:21 +0000 Received: from localhost ([127.0.0.1]:37902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwOPU-0007uG-4I for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:38:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1rwOPG-0007q0-HP for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:38:07 -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 <ludo@HIDDEN>) id 1rwOOy-0001UD-Fs; Mon, 15 Apr 2024 11:37:48 -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=1ICemtEEU1CmhNI7sFvE9ToBYNnUj1tEAAedcWXFjdc=; b=a+XL1m1yYrn9FByrq3AK ExBKiCq26aGxG9x/uxLvEA8Zy0/IIE/yWjt5NI+Q9TUix6yXVKvtjqpcQzBlkNh/t1UPkvAkabdLt YbnWn9EbsyzoyMmY28zQwI6GitrKoXTTyK173Se8YR4W47wDU8jpm5MDhz2YSxr/XOwBIHvTWem1r DY2vI8jRqXSSptky1jf9ob335zNy11Y0TAL1uLoVzbC8uhp63r8hfq+WDQC+IMoTYqDgW5OcnEn31 U/daNdBICHrViFAN1WLMGGfA/gLeGhTXWyjbQFQlv2DZt4kbEc9Ttv3UP/t1+W4iwKZOG9aygnNqo fbqwh+QfZ4Ej7Q==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Date: Mon, 15 Apr 2024 17:37:05 +0200 Message-ID: <f09974509ebd1aeffed10a2db08720bcedd039b5.1713194148.git.ludo@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <cover.1713194148.git.ludo@HIDDEN> References: <cover.1713194148.git.ludo@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Struct initialization uses one instruction per field, which contributes to code bloat in the case of package modules. With this change, the ‘.rtl-text’ section of ‘gnu/packages/tex.go’ goes from 7,334,508 B to 6,356,592 B (-13%; -7% on the whole file size), which alone is still larger than the source file (4,2 MB). * guix/records.scm (make-syntactic-constructor)[record-inheritance]: Use CTOR instead of ‘make-struct/no-tail’. Pass ABI-COOKIE as the first argument to CTOR. (define-record-type*): Define CTOR-PROCEDURE and pass it to ‘make-syntactic-constructor’. Change-Id: Ifd7b4e884e9fbf21c43fb4c3ad963126ef5cb476 --- guix/records.scm | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/guix/records.scm b/guix/records.scm index 48637ea0a4..dca1e3c2e7 100644 --- a/guix/records.scm +++ b/guix/records.scm @@ -164,16 +164,16 @@ (define-syntax make-syntactic-constructor (record-error 'name s "extraneous field initializers ~a" unexpected))) - #`(make-struct/no-tail type - #,@(map (lambda (field index) - (or (field-inherited-value field) - (if (innate-field? field) - (wrap-field-value - field (field-default-value field)) - #`(struct-ref #,orig-record - #,index)))) - '(expected ...) - (iota (length '(expected ...)))))) + #`(ctor #,abi-cookie + #,@(map (lambda (field index) + (or (field-inherited-value field) + (if (innate-field? field) + (wrap-field-value + field (field-default-value field)) + #`(struct-ref #,orig-record + #,index)))) + '(expected ...) + (iota (length '(expected ...)))))) (define (thunked-field? f) (memq (syntax->datum f) 'thunked)) @@ -249,8 +249,8 @@ (define-syntax make-syntactic-constructor (cond ((lset= eq? fields '(expected ...)) #`(let* #,(field-bindings #'((field value) (... ...))) - #,(abi-check #'type abi-cookie) - (ctor #,@(map field-value '(expected ...))))) + (ctor #,abi-cookie + #,@(map field-value '(expected ...))))) ((pair? (lset-difference eq? fields '(expected ...))) (record-error 'name s @@ -435,7 +435,13 @@ (define-syntax define-record-type* (sanitizers (filter-map field-sanitizer #'((field properties ...) ...))) (cookie (compute-abi-cookie field-spec))) - (with-syntax (((field-spec* ...) + (with-syntax ((ctor-procedure + (datum->syntax + #'ctor + (symbol-append (string->symbol " %") + (syntax->datum #'ctor) + '-procedure/abi-check))) + ((field-spec* ...) (map field-spec->srfi-9 field-spec)) ((field-type ...) (map (match-lambda @@ -502,7 +508,20 @@ (define-syntax define-record-type* #'id))))))) thunked-field-accessor ... delayed-field-accessor ... - (make-syntactic-constructor type syntactic-ctor ctor + + (define ctor-procedure + ;; This procedure is *not* inlined, to reduce code bloat + ;; (struct initialization takes at least one instruction per + ;; field). + (case-lambda + ((cookie field ...) + (unless (eq? cookie #,cookie) + (record-abi-mismatch-error type)) + (ctor field ...)) + (_ + (record-abi-mismatch-error type)))) + + (make-syntactic-constructor type syntactic-ctor ctor-procedure (field ...) #:abi-cookie #,cookie #:thunked #,thunked -- 2.41.0
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 4/5] packages: =?UTF-8?Q?=E2=80=98define-public=E2=80=99?= replacement calls =?UTF-8?Q?=E2=80=98module-export!=E2=80=99?= directly. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 15:39:04 +0000 Resent-Message-ID: <handler.70398.B70398.171319550330438 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398 <at> debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> X-Debbugs-Original-Xcc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171319550330438 (code B ref 70398); Mon, 15 Apr 2024 15:39:04 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 15:38:23 +0000 Received: from localhost ([127.0.0.1]:37904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwOPV-0007uO-Jq for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:38:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1rwOPG-0007q2-NG for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:38:08 -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 <ludo@HIDDEN>) id 1rwOOz-0001UY-K6; Mon, 15 Apr 2024 11:37:49 -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=Lzhqu2e+cAy1Td6udzgnsfK/iejWG8dEsKU670jPODA=; b=NsruURYwoStjrRLCluVZ MIxXquM/bL6MgDIRt+4s32RyGpCghD4xXDbetl/XkmjKMrmsCxShIgVB+mEYGiYEv4SHvRKC0E0m7 4yUr2LqKMNGcA0usT0/bRE3/l1aP/eurDYRLZuhbS92jCmXLef9a+ZebN85qWUcV77XnkOoKNhAqm jKYxpJQWbWHtXfOSaXU+hpdQN2aWyNstvmFRL/EGpHAFE33bo1Pn2eCS4So5tZ+RxsIGKy+Fm8nHc DBGKeo2CBU4wfMUeQ/20+i8x3j8i2/Z8yXeMusy8abmdJJ8rOcbwp3cEipCU7mVXXhjIodVNx2gqp pWhs63OL/RgStw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Date: Mon, 15 Apr 2024 17:37:06 +0200 Message-ID: <723be7e4e70628f32862b8c1043eee641c4ccf8c.1713194148.git.ludo@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <cover.1713194148.git.ludo@HIDDEN> References: <cover.1713194148.git.ludo@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) This reduces code bloat and loading overhead for package modules, which use ‘define-public’ extensively. * guix/packages.scm (define-public*): Use ‘define’ followed by ‘module-export!’ directly instead of ‘define-public’. Change-Id: I7f56d46b391c1e3eeeb0b9a08a9d34b5de341245 --- guix/packages.scm | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index bd6724cdd4..6c697bcc67 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -482,7 +482,8 @@ (define-syntax-parameter current-definition-location (define-syntax define-public* (lambda (s) "Like 'define-public' but set 'current-definition-location' for the -lexical scope of its body." +lexical scope of its body. (This also disables notification of \"module +observers\", but this is unlikely to affect anyone.)" (define location (match (syntax-source s) (#f #f) @@ -499,10 +500,21 @@ (define-syntax define-public* (syntax-case s () ((_ prototype body ...) - #`(define-public prototype - (syntax-parameterize ((current-definition-location - (lambda (s) #,location))) - body ...)))))) + (with-syntax ((name (syntax-case #'prototype () + ((id _ ...) #'id) + (id #'id)))) + #`(begin + (define prototype + (syntax-parameterize ((current-definition-location + (lambda (s) #,location))) + body ...)) + + ;; Note: Use 'module-export!' directly to avoid emitting a + ;; 'call-with-deferred-observers' call for each 'define-public*' + ;; instance, which is not only pointless but also contributes to + ;; code bloat and to load-time overhead in package modules. + (eval-when (expand load eval) + (module-export! (current-module) '(name))))))))) (define-syntax validate-texinfo (let ((validate? (getenv "GUIX_UNINSTALLED"))) -- 2.41.0
X-Loop: help-debbugs@HIDDEN 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?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 15:39:06 +0000 Resent-Message-ID: <handler.70398.B70398.171319550530464 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398 <at> debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> X-Debbugs-Original-Xcc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Received: via spool by 70398-submit <at> 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 <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwOPX-0007uo-5S for submit <at> 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 <ludo@HIDDEN>) id 1rwOPG-0007q5-Qe for 70398 <at> 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 <ludo@HIDDEN>) 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?= <ludo@HIDDEN> Date: Mon, 15 Apr 2024 17:37:04 +0200 Message-ID: <5668e959834c21809c42c1556359eb65bf285caf.1713194148.git.ludo@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <cover.1713194148.git.ludo@HIDDEN> References: <cover.1713194148.git.ludo@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) 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 <ludo@HIDDEN> +;;; Copyright © 2012-2024 Ludovic Courtès <ludo@HIDDEN> ;;; Copyright © 2014, 2015, 2017, 2018, 2019 Mark H Weaver <mhw@HIDDEN> ;;; Copyright © 2015 Eric Bavier <bavier@HIDDEN> ;;; Copyright © 2016 Alex Kost <alezost@HIDDEN> @@ -430,15 +430,26 @@ (define %cuirass-supported-systems ;; <https://lists.gnu.org/archive/html/guix-devel/2017-03/msg00790.html>. (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
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 5/5] packages: Reduce code bloat due to list allocation in input fields. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 15:39:07 +0000 Resent-Message-ID: <handler.70398.B70398.171319550830489 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398 <at> debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> X-Debbugs-Original-Xcc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171319550830489 (code B ref 70398); Mon, 15 Apr 2024 15:39:07 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 15:38:28 +0000 Received: from localhost ([127.0.0.1]:37908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwOPZ-0007vF-8Z for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 11:38:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1rwOPH-0007qJ-GZ for 70398 <at> 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 <ludo@HIDDEN>) id 1rwOP0-0001Uv-F0; Mon, 15 Apr 2024 11:37:50 -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=5vXsn8BSLiVvAWZCYbh1dNBBvzLJn4lDK2zl8EwU1cw=; b=Y0I7T/nN6wfQPUlEGQ0C +40E6lYiOFeR7ItfcJkyd0c6q7xnvj70+3j1J4geC5Kpp4D8xFVqFstFjamN7nvhRI5ADVVIGUccV XKJhrTtdhds1Sl5uCZqt+xC4UDE8C7TAKn24r1/ltWU2vldiv1WisnU8QuqFFnpscz4EJ7WB8iJ5e eZkzAyKeUEIPq3BOLopT99TOiPS6nq2czeif8ajMsmfE9KK6oEIKHMr+cipvbN7pm7FwKAuOHqUTj Li2cx+tVduWn8Iu3KlU1kq6BihadjnEKE8FMRvtC3hZToKlWiRMTb07JPdQnk8YDIfI8tnt2xy2EE 3LLKdRQnXXEv6w==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Date: Mon, 15 Apr 2024 17:37:07 +0200 Message-ID: <e66ee292ea3368424d1ec904a45c804f5fa81879.1713194148.git.ludo@HIDDEN> X-Mailer: git-send-email 2.41.0 In-Reply-To: <cover.1713194148.git.ludo@HIDDEN> References: <cover.1713194148.git.ludo@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) * 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
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 0/5] Reduce the size of gnu/packages/*.go files Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 16:11:02 +0000 Resent-Message-ID: <handler.70398.B70398.171319745526596 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398 <at> debbugs.gnu.org Cc: Josselin Poiret <dev@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Christopher Baines <guix@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171319745526596 (code B ref 70398); Mon, 15 Apr 2024 16:11:02 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 16:10:55 +0000 Received: from localhost ([127.0.0.1]:38095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwOuz-0006ui-Kg for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 12:10:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1rwOuw-0006tQ-KK for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 12:10:52 -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 <ludo@HIDDEN>) id 1rwOud-0007UN-Ib; Mon, 15 Apr 2024 12:10:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=vGJVl6Kb5fzc0SrhBkq4yzX6PvLgoZ64cBuxgJZaOPg=; b=NAX6sFAQ66N6NwZe811L zKgl/FA0tejKu6IFVBMNmDhe6AgeRXRTIzRcbl1bpWbemJeQNbHrXhuXC29FidUlZ2TRdYhhHOw+v c1KY3eFY+6bBKsK+A5Qr/RoUEUE8Lj0rxaFUNlnar+QsXAm7f39BIxIWB6mdhH0m3sT2aw4Q5C+ql UuA6O1nGzovgl/1d6CmirlFFEFrpWRdOqAvkMiI7KPWq6sfI3XibXkfg/BDkzZFomiRo4O8TLBpEz 7jz7d7M8H3jCPytuowP3aorq2y6leApv/EGltQ3qyyZvdvTnqN0HOyWhYwEbiEtu6fQr4WSeM2Ugz hfhPnADUj1ikzg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> In-Reply-To: <cover.1713194148.git.ludo@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 15 Apr 2024 17:27:36 +0200") References: <cover.1713194148.git.ludo@HIDDEN> Date: Mon, 15 Apr 2024 18:10:28 +0200 Message-ID: <87cyqq1ua3.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s <ludo@HIDDEN> skribis: > What follows is a bunch of tricks to reduce code bloat, achieving ~14% > reduction in the size of .go files (~18% if we look at gnu/packages > alone). On this topic, you may also like this earlier post: https://lists.gnu.org/archive/html/guix-devel/2020-06/msg00071.html Ludo=E2=80=99.
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 0/5] Reduce the size of gnu/packages/*.go files Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 16:26:04 +0000 Resent-Message-ID: <handler.70398.B70398.17131983291678 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70398 <at> debbugs.gnu.org Cc: Josselin Poiret <dev@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Christopher Baines <guix@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.17131983291678 (code B ref 70398); Mon, 15 Apr 2024 16:26:04 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 16:25:29 +0000 Received: from localhost ([127.0.0.1]:38186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwP96-0000R0-Il for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 12:25:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1rwP8s-0000Nh-Bb for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 12:25:26 -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 <ludo@HIDDEN>) id 1rwP8V-0001VI-VR; Mon, 15 Apr 2024 12:24:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=vGJVl6Kb5fzc0SrhBkq4yzX6PvLgoZ64cBuxgJZaOPg=; b=SrwppJpY9PENsblFW90c xeYS124rtBvP2P4lZndPp6C6QwRxoPXGcmt6t1aCIIOQq8I4BVF4mX4ohFSWgkty8Y81jczlRzrcW aEEQJBSvLK1PyuTqBiG8Rxyy2uZbD1/dB/6jiE9uIll4mbdBo4WRzCGHfG3Oqpep4CWjwBG9BvgK3 WjhMUfgu5NpO10C2JnK1mYGTKEPNK27jom5PLKtmMPGxlOOqnPi26Q1abZr6L9Up/uMtg5ay7VPJ2 jyaWqeqUGfX6ZkkWgACPDv65METsskeXYfLxc4DH7fxkmN9m7jm2+2PALgrvGVxnTLhKgsQogJL57 E3+gDnR44g8d7w==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> In-Reply-To: <cover.1713194148.git.ludo@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 15 Apr 2024 17:27:36 +0200") References: <cover.1713194148.git.ludo@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Mon, 15 Apr 2024 18:24:25 +0200 Message-ID: <87sezmzj9i.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s <ludo@HIDDEN> skribis: > What follows is a bunch of tricks to reduce code bloat, achieving ~14% > reduction in the size of .go files (~18% if we look at gnu/packages > alone). On this topic, you may also like this earlier post: https://lists.gnu.org/archive/html/guix-devel/2020-06/msg00071.html Ludo=E2=80=99.
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 5/5] packages: Reduce code bloat due to list allocation in input fields. Resent-From: Simon Tournier <zimon.toutoune@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 18:08:03 +0000 Resent-Message-ID: <handler.70398.B70398.171320445223048 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Cc: Ricardo Wurmus <rekado@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, 70398 <at> debbugs.gnu.org, Christopher Baines <guix@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171320445223048 (code B ref 70398); Mon, 15 Apr 2024 18:08:03 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 18:07:32 +0000 Received: from localhost ([127.0.0.1]:38764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwQjq-0005zU-8P for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 14:07:32 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:39021) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1rwQjn-0005xy-78 for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 14:07:28 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-346407b8c9aso1508271f8f.0 for <70398 <at> debbugs.gnu.org>; Mon, 15 Apr 2024 11:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713204429; x=1713809229; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hWue6cf8r6MECGGViNQp2lK8pvPZEuWZX5dVuOENq7g=; b=K+w3Q06BsrLUxWxM5/YFptPTcgtRsSnCFKaujtdKX6X71z6rVXxFOFnB8abA20iRgH DyHkZxd5PO6FcqQ6QpLaYcPokDwyBhnIVpGGApHeMOOEgw2Nx+KiGz2GVlX/uok0muVW jzbyOzXb4OvXBc0h8Ps2CDFpaaXK7u6FJMGore8BnljGBGEKVyxINtVm35/NhPewV7LB 6EnQbGyvic96VJWtmClJU5jr4Cao4iGrhukT3hyCujYAMyVxMRRwuCb94AQfEvRdM72+ hai3Ta79VPPoc3q667AZY6mWH2ahCcJBpyb2w5lNOI+oCCa44nLpSWwtABeh8xF5dCpO 8kwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713204429; x=1713809229; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hWue6cf8r6MECGGViNQp2lK8pvPZEuWZX5dVuOENq7g=; b=nFVCwsUaCe0yvXsRC6NMDuupopXOU4qjjwrPbxeKn2Ul/x4QJgtBLGNtmYbfMuGJFM YoO0s/3MpQPo4kGd2wSw9Ur/55FJTQxvqRJHGv+JQFuxMSWeao/KPgfs0VIa/nrf/1gD EIbhUe23AB0k3FWg132y8la8lhquvGEsB+jLmgxOts3VymIcfXBU5cq5negldY7l76a0 PLLNw4PztDF6JTTVz+NXiEAyBe89Iq8qXobObKy9an/dPZrqRjxyHEYT5Weqdjmpd+m2 bppQBzut1ZeILuAURfj1uZJQsnX7nlobVXeKl1A83Gjar7Ty8CnJqKZlBNWAm9mv27Ed exDw== X-Gm-Message-State: AOJu0YyWFkhCDuiHFj6cgw3jJtBCzClYjTugvoltlfXE2fDg4nsxy5iQ 39drOEl8lPlcU5BNNXIJiy9YXNs35bjLkOaAwwAk0erLTHu8NxxL X-Google-Smtp-Source: AGHT+IE/sh82i9bxq+xirUwm2iqrKxNEzS5G4lqGjOwNRbQiotvhedIEEWvIhW63goDr6GtOoQdAYA== X-Received: by 2002:a05:600c:474a:b0:417:29a3:3f4f with SMTP id w10-20020a05600c474a00b0041729a33f4fmr7859849wmo.2.1713204429104; Mon, 15 Apr 2024 11:07:09 -0700 (PDT) Received: from lili (roam-nat-fw-prg-194-254-61-40.net.univ-paris-diderot.fr. [194.254.61.40]) by smtp.gmail.com with ESMTPSA id k21-20020a05600c1c9500b004182a36b185sm9785647wms.2.2024.04.15.11.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 11:07:08 -0700 (PDT) From: Simon Tournier <zimon.toutoune@HIDDEN> In-Reply-To: <e66ee292ea3368424d1ec904a45c804f5fa81879.1713194148.git.ludo@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 15 Apr 2024 17:37:07 +0200") References: <cover.1713194148.git.ludo@HIDDEN> <e66ee292ea3368424d1ec904a45c804f5fa81879.1713194148.git.ludo@HIDDEN> Date: Mon, 15 Apr 2024 19:56:08 +0200 Message-ID: <87zftuik7b.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Ludo, On lun., 15 avril 2024 at 17:37, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote: > + ((_ (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 ...)) I am not sure to understand: =C2=AB (list ...) is open-coded, which can lead to a long list of instructions. =C2=BB. Well, irrelevant for .go size but why not something like: ((_ (list args . rest)) (apply add-inputs-labels (append args rest))) It would not change for .go size but it would change for run-time if it=E2=80=99s a long list, no? Cheers, simon
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 0/5] Reduce the size of gnu/packages/*.go files Resent-From: Simon Tournier <zimon.toutoune@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 18:08:04 +0000 Resent-Message-ID: <handler.70398.B70398.171320447123243 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Cc: Ricardo Wurmus <rekado@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, 70398 <at> debbugs.gnu.org, Christopher Baines <guix@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171320447123243 (code B ref 70398); Mon, 15 Apr 2024 18:08:04 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 18:07:51 +0000 Received: from localhost ([127.0.0.1]:38767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwQjy-00060r-3D for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 14:07:51 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:39027) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1rwQjo-0005yL-Tf for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 14:07:30 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-346407b8c9aso1508287f8f.0 for <70398 <at> debbugs.gnu.org>; Mon, 15 Apr 2024 11:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713204431; x=1713809231; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p21/OzxrzbuyZQyBn5O47bphdKN+aIRNy0DtxhBIn6g=; b=eoTWP8yTgYgESiRz+yBfKoGR+3a0hIKtomms3Hyf6WknV8F3mlCQDBSIR8MHHvnyyH Tr9SWideqpdQiaVqjL7S0CbKEM9qkG1yciAg1QkelVeMXCZk0ZnbYB8IWCKPhoRARIcp co31u3JCPCpuUjCxKSFbK5DQ1sdT4juwAHYfBwMC5+WEISMKlHTbBSvzokBNw0S0zuxH TknEiy+6iSoUUuvO8aoLF+61TtA2PjywPBozXoCT/aATytKPS93oRXiGPei8HAelZUBV GMzT/PtDc1fr5kgohZlM+4sOuvrCJncC7JCOs15vhmbl0tx8ge0IKtyGcaq32dEvH8p2 oyjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713204431; x=1713809231; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=p21/OzxrzbuyZQyBn5O47bphdKN+aIRNy0DtxhBIn6g=; b=fW/gG6MFJj5O6gmHT39vDjX/knZtizYa1DLzqXzyaP5UeowAbtaRe/Q37izVuQNOkf qPirfGXxASDN5o2GxVGlIQ+fnX6Lqgt5rTbJZNuyrKaf+qpTwylM0BVyj9B0bkMBubYQ +H4F/sk8uywZ5vzI+fg8f8tz7Shbfze2QbopOBsdfuVNOR/aol9DFY3CCSV5O3KiI/Ag GU35JrdvbHgqc+DJE77xoZLNt8OX+9OCwN/V3Fe3D6vTcw2lXs8+zYhKHj9xmwHR3r0x a1sqTLZFhCvc0pqK9cg4/AIUkhUStWLTIcirLzFg/J2eK3upLDj+YLoY/LR6vAhOQiQ9 eYiQ== X-Gm-Message-State: AOJu0YxSJ4FUxKZLYwlDmWP3R4f7Nm+8F8SbRSiT95SCZyHRsViVPDac 8lk2m+ApAnro2EXwnGrz7dHeyv3gMz5XklGD1zWtJpPlhQRcvNuY X-Google-Smtp-Source: AGHT+IFEofrkrHpOgcaEhwQnsT8LQoo3b/RVOqPneYZk21ogkRfVIIH2ZK9whkdabQIq7h7gRwPuEg== X-Received: by 2002:a05:600c:6908:b0:418:c7a:c215 with SMTP id fo8-20020a05600c690800b004180c7ac215mr6556240wmb.1.1713204431126; Mon, 15 Apr 2024 11:07:11 -0700 (PDT) Received: from lili (roam-nat-fw-prg-194-254-61-45.net.univ-paris-diderot.fr. [194.254.61.45]) by smtp.gmail.com with ESMTPSA id r11-20020a05600c458b00b00417f7ddd21dsm14104842wmo.37.2024.04.15.11.07.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 11:07:10 -0700 (PDT) From: Simon Tournier <zimon.toutoune@HIDDEN> In-Reply-To: <cover.1713194148.git.ludo@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 15 Apr 2024 17:27:36 +0200") References: <cover.1713194148.git.ludo@HIDDEN> Date: Mon, 15 Apr 2024 20:06:15 +0200 Message-ID: <87wmoyijqg.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi, On lun., 15 avril 2024 at 17:27, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote: > What follows is a bunch of tricks to reduce code bloat, achieving ~14% > reduction in the size of .go files (~18% if we look at gnu/packages > alone). If have not checked that the reduction would be of ~18%. From my understanding, the patch set LGTM; modulo an unrelated comment about ellipsis and potential quadratic penalty on performances. > About 60% of those files are in the 64=E2=80=93128 KiB range. Since ELF = sections > are currently 64 KiB-aligned (see =E2=80=98*lcm-page-size*=E2=80=99 in Gu= ile), we would > save space by ensuring these are sparse files. To do that, we=E2=80=99ll= need to > detect holes when restoring nars and/or to change the nar format to > preserve holes, while also ensuring that when the daemon copies files > around, it also preserves holes. Work for later! Since [1], I think that compiling a generic Guile record for <package> is touching the limit of DSL. :-) Other said, I think the binary (compiled) representation of records <package> should be specific and thus optimized. Work for after later. ;-) Cheers, simon 1: How many bytes do we add (closure of guix) when adding one new package? Simon Tournier <zimon.toutoune@HIDDEN> Thu, 25 May 2023 20:24:30 +0200 id:87r0r4uv4x.fsf@HIDDEN https://lists.gnu.org/archive/html/guix-devel/2023-05 https://yhetil.org/guix/87r0r4uv4x.fsf@HIDDEN
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 0/5] Reduce the size of gnu/packages/*.go files Resent-From: Simon Tournier <zimon.toutoune@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 18:51:03 +0000 Resent-Message-ID: <handler.70398.B70398.171320700823108 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Cc: Ricardo Wurmus <rekado@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, 70398 <at> debbugs.gnu.org, Christopher Baines <guix@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171320700823108 (code B ref 70398); Mon, 15 Apr 2024 18:51:03 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 18:50:08 +0000 Received: from localhost ([127.0.0.1]:38963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwRP1-0005zz-Ux for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 14:50:07 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:39075) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>) id 1rwROv-0005xc-AU for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 14:50:02 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-346407b8c9aso1520763f8f.0 for <70398 <at> debbugs.gnu.org>; Mon, 15 Apr 2024 11:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713206979; x=1713811779; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LPeHmnUk2Z7i0EEa0JU4U20gdVzYmUzmRrs3W5y5W/U=; b=kZ2dpPkPHSkZ4gFcDcypFwyrS0uToDY1XnLa95LBV+x+or2aKwUHa6eCqnxgPWnG4E R/4ATwIF1xhDGzy4l7/98FXpreVa4jo4FHzo1GeB6cAl9SeQzmhAsUoLuJ7j93+G4c/2 5ioxYKPzgDiI3Xg6ZtFHXPweMsoZT1ZXlp1Weemqwv/Q9LbKashJy0fJDL+A7FX4/xNJ XkoidBkgXgmx5YRLP0Av5Xa+sYnPxL6Gv0wmSs2wBe+H+TVCCkT0BCjYqb7tcFYoI7U6 C7Ehi/KWilZEtdKwU+uMe3blWEm6TqPH+Gt+38JlXGPgPSk2mak78KDyMvsrkBv/wwll Y8Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713206979; x=1713811779; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LPeHmnUk2Z7i0EEa0JU4U20gdVzYmUzmRrs3W5y5W/U=; b=Jvifm+jUoM27dJkiBQMKhH1VCwW2xseG25OExSqK0zgkf7di/JcgYW5fflHpYEUZxd PYpe56SrBJOtAaUjfrN7KuGV4CDpSevDzcL2z3tqO2BwPh2e6515eVInv7UiJXFLV3Om AvtYylYSsp+zxsmT3ViVaeyKgrDY+fPuuclauBe827UEBde9eK/lO7BWE8aAsRMrk8a2 nC1X4RDojjEQyomvvIajM62eO1XRaHg7BVKild2IO0qQ/CNL5jVtM6X0UiVlyksIJve2 4BEgn1GR/vwBTDiTKvpcBGRkvHW0yvFUE14/0R3HUvfq4O0MsSJuey657QdpS2jcI4oU E9pQ== X-Gm-Message-State: AOJu0YxRRO9jCdrcbPNTjzp3nHkcSotR20RiybElQJ6X+02YCYrBJkAy YAYvNAymWnUSyiPM639wxkwvvHC7qYwcQOwKclkeJZ71Yk3RGbUm X-Google-Smtp-Source: AGHT+IEn1eMcuROIyoksmYv/HFwkGZxjFqxZ7ZT/rsl3rLeN0PH6oZVzOsmfWAwcOetPIAPTnWxg7A== X-Received: by 2002:a05:600c:474a:b0:417:29a3:3f4f with SMTP id w10-20020a05600c474a00b0041729a33f4fmr7919164wmo.2.1713206979342; Mon, 15 Apr 2024 11:49:39 -0700 (PDT) Received: from lili (roam-nat-fw-prg-194-254-61-46.net.univ-paris-diderot.fr. [194.254.61.46]) by smtp.gmail.com with ESMTPSA id df12-20020a5d5b8c000000b00343a3e62997sm12693768wrb.50.2024.04.15.11.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 11:49:38 -0700 (PDT) From: Simon Tournier <zimon.toutoune@HIDDEN> In-Reply-To: <87cyqq1ua3.fsf@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 15 Apr 2024 18:10:28 +0200") References: <cover.1713194148.git.ludo@HIDDEN> <87cyqq1ua3.fsf@HIDDEN> Date: Mon, 15 Apr 2024 20:49:32 +0200 Message-ID: <87sezmihqb.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi, On lun., 15 avril 2024 at 18:10, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote: > Ludovic Court=C3=A8s <ludo@HIDDEN> skribis: > >> What follows is a bunch of tricks to reduce code bloat, achieving ~14% >> reduction in the size of .go files (~18% if we look at gnu/packages >> alone). > > On this topic, you may also like this earlier post: > > https://lists.gnu.org/archive/html/guix-devel/2020-06/msg00071.html And unrelated to this patch set, let also mention this other thread [1], comparing (btrfs): --8<---------------cut here---------------start------------->8--- # compsize /gnu/store/nqrb3g4l59wd74w8mr9v0b992bj2sd1w-guix-d62c9b267-modul= es/lib/guile/3.0/site-ccache/gnu Processed 503 files, 1317 regular extents (1317 refs), 0 inline. Type Perc Disk Usage Uncompressed Referenced TOTAL 27% 40M 144M 144M none 100% 10M 10M 10M zstd 22% 30M 133M 133M # compsize /gnu/store/s6rqlhqr750k44ynkqqj5mwjj2cs2yln-guix-a09968565-modul= es/lib/guile/3.0/site-ccache/gnu Processed 530 files, 1169 regular extents (1169 refs), 0 inline. Type Perc Disk Usage Uncompressed Referenced TOTAL 19% 22M 116M 116M none 100% 32K 32K 32K zstd 19% 22M 116M 116M --8<---------------cut here---------------end--------------->8--- Compared to (ext4): --8<---------------cut here---------------start------------->8--- 145M /gnu/store/nqrb3g4l59wd74w8mr9v0b992bj2sd1w-guix-d62c9b267-modules/lib= /guile/3.0/site-ccache/gnu 117M /gnu/store/s6rqlhqr750k44ynkqqj5mwjj2cs2yln-guix-a09968565-modules/lib= /guile/3.0/site-ccache/gnu --8<---------------cut here---------------end--------------->8--- Somehow, these packages .go files could be compressed and decompressed on the fly when needed. Cheers, simon 1: Re: How many bytes do we add (closure of guix) when adding one new packa= ge? Guillaume Le Vaillant <glv@HIDDEN> Wed, 31 May 2023 12:47:09 +0000 id:87h6rsll5i.fsf@kitej https://lists.gnu.org/archive/html/guix-devel/2023-05 https://yhetil.org/guix/87h6rsll5i.fsf@kitej
X-Loop: help-debbugs@HIDDEN Subject: [bug#70398] [PATCH 5/5] packages: Reduce code bloat due to list allocation in input fields. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Mon, 15 Apr 2024 20:32:03 +0000 Resent-Message-ID: <handler.70398.B70398.171321311124381 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 70398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier <zimon.toutoune@HIDDEN> Cc: 70398 <at> debbugs.gnu.org, Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Christopher Baines <guix@HIDDEN> Received: via spool by 70398-submit <at> debbugs.gnu.org id=B70398.171321311124381 (code B ref 70398); Mon, 15 Apr 2024 20:32:03 +0000 Received: (at 70398) by debbugs.gnu.org; 15 Apr 2024 20:31:51 +0000 Received: from localhost ([127.0.0.1]:39457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rwSzV-0006Kz-3W for submit <at> debbugs.gnu.org; Mon, 15 Apr 2024 16:31:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1rwSzT-0006Jv-MP for 70398 <at> debbugs.gnu.org; Mon, 15 Apr 2024 16:31:48 -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 <ludo@HIDDEN>) id 1rwSzC-0002Yb-Ag; Mon, 15 Apr 2024 16:31:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=9UObZ4NCjgxd1bEK1ZChK7VcgRNgJJmkNJG6EUXJWEo=; b=FiG5lWOI/i4I3+OI96DI BbE0mukDquqhcSi2sdt4JPJCrbS2u9xXcom1Xa3nPxwW6dNXIgyoWX+WDU1LBgmezYVSm8Rc57f9R QzWaWPecCsKJq0bsOUDPR4kIac/AFtdlKcj+Ir/tNNRVW5EsqAaxOJiEjQHZ/fyfA1SfGJgzBGlAv OqCHaAtVXDC0WXONJl+XpQg8xOkD6mwiYzWh0XOvV/Q1xrjR+2TfeHtBiaNTzLC3MbdUqIg5wA2G7 ppG4aZVAXUUlAt5LoQz0h3hqdAmpGSR7c5ni68TSRRiWG+PXYVcBDlpEIJnkmxC1s0pb/OnsBuNxV cG5MmdwKFfpnDA==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> In-Reply-To: <87zftuik7b.fsf@HIDDEN> (Simon Tournier's message of "Mon, 15 Apr 2024 19:56:08 +0200") References: <cover.1713194148.git.ludo@HIDDEN> <e66ee292ea3368424d1ec904a45c804f5fa81879.1713194148.git.ludo@HIDDEN> <87zftuik7b.fsf@HIDDEN> Date: Mon, 15 Apr 2024 22:31:20 +0200 Message-ID: <877cgyz7tz.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Simon Tournier <zimon.toutoune@HIDDEN> skribis: > On lun., 15 avril 2024 at 17:37, Ludovic Court=C3=A8s <ludo@HIDDEN> wrot= e: > >> + ((_ (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 calle= e. >> + (add-input-labels args ...)) > > I am not sure to understand: =C2=AB (list ...) is open-coded, which can l= ead > to a long list of instructions. =C2=BB. This: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,c (lambda () (list 1 2 3 4)) [...] 8 (allocate-words/immediate 0 2)=20=20 9 (scm-set!/immediate 0 0 2)=20=20=20=20=20=20 10 (scm-set!/immediate 0 1 1)=20=20=20=20=20=20 11 (allocate-words/immediate 2 2)=20=20 12 (scm-set!/immediate 2 0 3)=20=20=20=20=20=20 13 (scm-set!/immediate 2 1 0)=20=20=20=20=20=20 14 (allocate-words/immediate 3 2)=20=20 15 (scm-set!/immediate 3 0 4)=20=20=20=20=20=20 16 (scm-set!/immediate 3 1 2)=20=20=20=20=20=20 17 (allocate-words/immediate 4 2)=20=20 18 (scm-set!/immediate 4 0 5)=20=20=20=20=20=20 19 (scm-set!/immediate 4 1 3)=20=20=20=20=20=20 --8<---------------cut here---------------end--------------->8--- > Well, irrelevant for .go size but why not something like: > > ((_ (list args . rest)) > (apply add-inputs-labels (append args rest))) That=E2=80=99s more code and I=E2=80=99m really trying hard to minimize gen= erated code. :-) Ludo=E2=80=99.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.