From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 0BVPKlVxWGc1GQEAe85BDQ:P1 (envelope-from ) for ; Tue, 10 Dec 2024 16:50:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 0BVPKlVxWGc1GQEAe85BDQ (envelope-from ) for ; Tue, 10 Dec 2024 17:50:29 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=J7QOytsh; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=haOdTCE5; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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=1733849429; a=rsa-sha256; cv=none; b=gKM0ORCpaOvybQJcvd/R0vdL4dTt60RzMWSqh3yBM4MnspLpFvm3Vw+o3VR2o03zOx+ISK IqVjcc1Jb6thKZtgCcolje9n1L0dP1HHa5JMI3qaVcl7EMAOMy8f/GtuUe8VrMA2PxcHc+ MRduxn+7JyhJ5NEUgi3J9Fg9YSbXWAv5VWtOvnYl0WEe5xO6j8QXXB/lsqLOvOtVqZbFZe FfB+C8pEg5BTR+4ZGN9g2slsiCl8xmUYesr13X/bCq3d0oUI58LhHtSpY/xF5BlgIAtYAX vzG3Q/gttwcr5t1ay2mzRWcLapRPgcHwQWqsKL8Nyr8qq09HX/agequvtVv2Yw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=J7QOytsh; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=haOdTCE5; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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=1733849429; 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=IoZm+PSI8M4gdV9Ej6aaYiGVKT96odwvpKCzXqs6SrI=; b=b99DTSQtgxzCuh4ZEwTHh/3naD6A+Z5f/jRQiyuyfhcaMLwEYvBaqqWCffgkWNUmH9SNd0 Rl8eBhEoWyPmcvDj6Dd15tl2YBAWQPaP+PJ0KzoKqESeBzQY7dGvK+MKOCNAzkfZ2SNow0 o+YUYfBZIsbrQrwEtV577bc2WlYBKw5T5m18gBtQnrrfosJut1Rsh9sNwOTJpe+yPh6Oe0 Kj5k0UuHFrBtqIj+kNHAyfHvl8iVet/WdmIeTaAS0RTA/gWzQWIRwfNGm/Qg6yRkw3yPeR rAENaTtuvzY0hpFG85luka8WhaH9fOyS1jBeEVJ1CIxeH+zqswnwdklvT6uRGw== 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 20DD363F1A for ; Tue, 10 Dec 2024 17:50:29 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL3R3-0001LE-5F; Tue, 10 Dec 2024 11:50:09 -0500 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 1tL3R0-0001Jg-RX for guix-patches@gnu.org; Tue, 10 Dec 2024 11:50:07 -0500 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 1tL3R0-00047r-Fr for guix-patches@gnu.org; Tue, 10 Dec 2024 11:50:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=IoZm+PSI8M4gdV9Ej6aaYiGVKT96odwvpKCzXqs6SrI=; b=J7QOytshMKOi+Hj3p2k9dAQzGvoH44mPZb2IIDr5gUTTwl544IGkiUfVAr/Bx58Kf1XwIjMxXSeSc+cZcj3YJFVNoRDVUfujQl/GN9Y4cqiThqQJuSF0SdWulDds23Wp4JQY1qxzgDgNDgOx9YA0/tsJ1rUgSjdcNnkIay8pe5fofeVcIl+QjwAlyTUR1qAB1KsdWGjE+Hgka00KPmmPhwpfZowFmLrhmSXo6S8tYDqWgzitYvtTs+avwYTWY8Y+MnGMaTbFHXz2wtLcYjy449pO9N1LGePoEUTYRb4fA/m+t5Dvg2ZrDFhXVdnSXlDRLnNV8mqlI8ou3qAMPJ8ieg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tL3R0-0005jg-8y for guix-patches@gnu.org; Tue, 10 Dec 2024 11:50:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74654] [PATCH 2/5] packages: Optimize =?UTF-8?Q?=E2=80=98all-packages=E2=80=99.?= Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 10 Dec 2024 16:50:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74654 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 74654@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 74654-submit@debbugs.gnu.org id=B74654.173384940521996 (code B ref 74654); Tue, 10 Dec 2024 16:50:06 +0000 Received: (at 74654) by debbugs.gnu.org; 10 Dec 2024 16:50:05 +0000 Received: from localhost ([127.0.0.1]:59304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL3Qx-0005iK-GD for submit@debbugs.gnu.org; Tue, 10 Dec 2024 11:50:04 -0500 Received: from mail-wr1-f42.google.com ([209.85.221.42]:52318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL3Qv-0005hH-JZ for 74654@debbugs.gnu.org; Tue, 10 Dec 2024 11:50:02 -0500 Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3862ca8e0bbso3404616f8f.0 for <74654@debbugs.gnu.org>; Tue, 10 Dec 2024 08:50:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733849336; x=1734454136; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IoZm+PSI8M4gdV9Ej6aaYiGVKT96odwvpKCzXqs6SrI=; b=haOdTCE5aqCMd5EXWYDiXRuAvRslNhFDEYc9f0nHxJwiEAaztZ1vIiw7Qnxr/W7v46 M5Ha8TztWjnNANW30lUvivpp+unEygigxR/4m5OtJJeh6YdQjbzdrG/wIJaET5Z/vAjV qni8oYQv1SmhzDWsx6lPV0s8+/H+Sw8qfazFI+iqbLY2rvqLf+c279/eUMPZqs9rbD01 G5iT14lPL+eeQG/tvQ+4oHBk2Ij7ejF9dXazAfXX8DNSFtWMPH21D98wsKvECf1jX6DZ FWSxrJcMSl3HRNUkB2hmEvZ7REaEQSJEFVjdcEzbWpCYlnVuyP6nec+bwEMSAccAG01n 7U0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733849336; x=1734454136; h=content-transfer-encoding:mime-version: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=IoZm+PSI8M4gdV9Ej6aaYiGVKT96odwvpKCzXqs6SrI=; b=mSOtmp5Tiv5B1AozCMI6JhlOvNe4b40FKxKHWdGA1O0EDNgfGpwiVThmvy7WGoDdTx gapb48zF5TBnMmzwUCRcJDNkUglLDsYIs3QtA2inw/HiVlchQUBokwszabA08njTB9z0 tvNjfHyN6ED2c/KO53B27AYwaIlYi+ya8KsB88QsmdIfklEb1g43JA3BmULJt0x2bVSL gsDSOfiTImHnt0oluLi6zWq/nRtd/qRszi8snyHeiB9FsBtmdBDrksvOQOFNbPWYMdRh G7VkBvXPMLaY18We++HAkAiibIFfaBF8PfyMU2KG9+dNXBFnvEQ5zDdlKG44CZk5jiiM rRVQ== X-Forwarded-Encrypted: i=1; AJvYcCXv9NvfZ5ykmtjiSK05FCtZlpvX4XgAhu1wgwx2gSK+2cKjB9E81sjrJXyhPVNiAn5TS9pncA==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yyvs18joieZiMQAcLDdN1bPLJfNyLUSo+I4jS0e+PzGp1Wo/SXF DDH7qfxEOmHveC/LPIXWdYbswKR+Mz6d6Mk5eNGiKRwxzCIjnN6VBzn3Ng== X-Gm-Gg: ASbGnct1+E08rwJMShlIo+CoKuAR4L/MzC/EDAHUbSSfY1GZm9TfZVhuB22cAZ4/d3y m7bfBrnujbnXMCM1AzkdHXBhIVzZCkMJZz374tMCTOOeIVCLHTsR2p4VObUz8HoduXxMbfTtrx8 Peiz32VSI6aktOx7SiwpukDT857Vl99ODdeqy9AzLbcI69wKx64xDop2S+UKTP9GpgNFDRg5yrx o77mKcLuVGOsAbzz6tUW4JidFWC4DxC7/HoPFZ9pPYWEPGJ8g== X-Google-Smtp-Source: AGHT+IHVOiO3Eq+eirp35tZ20CnMCsPI2Epck72oGvPqzuLt1CQqMY32Tkxp4fKAtn+qtfldfizgIw== X-Received: by 2002:a05:6000:42c5:b0:385:ef8e:a652 with SMTP id ffacd0b85a97d-386453fd87bmr3808247f8f.56.1733849335564; Tue, 10 Dec 2024 08:48:55 -0800 (PST) Received: from lili ([148.60.59.223]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3863e655c1dsm6421922f8f.1.2024.12.10.08.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:48:55 -0800 (PST) From: Simon Tournier In-Reply-To: <642880c208f4445f1d63dba5618a315671d558e2.1733158049.git.ludo@gnu.org> References: <642880c208f4445f1d63dba5618a315671d558e2.1733158049.git.ludo@gnu.org> Date: Tue, 10 Dec 2024 15:05:57 +0100 Message-ID: <878qsn1vlm.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-Migadu-Spam-Score: -1.48 X-Spam-Score: -1.48 X-Migadu-Queue-Id: 20DD363F1A X-Migadu-Scanner: mx12.migadu.com X-TUID: ofZAPhOv5n+E Hi, On Mon, 02 Dec 2024 at 17:53, Ludovic Court=C3=A8s wrote: > - (delete-duplicates > - (fold-packages (lambda (package result) > - (match (package-replacement package) > - ((? package? replacement) > - (cons* replacement package result)) > - (#f > - (cons package result)))) > - '() > + ;; Note: 'fold-packages' never traverses the same package twice but > + ;; replacements break that (they may or may not be visible to > + ;; 'fold-packages'), hence this hash table to track visited packages. > + (define visited (make-hash-table)) >=20=20 > - ;; Dismiss deprecated packages but keep hidden packa= ges. > - #:select? (negate package-superseded)) > - eq?))) > + (fold-packages (lambda (package result) > + (if (hashq-ref visited package) > + result > + (begin > + (hashq-set! visited package #t) > + (match (package-replacement package) > + ((? package? replacement) > + (hashq-set! visited replacement #t) > + (cons* replacement package result)) > + (#f > + (cons package result)))))) > + '() > + > + ;; Dismiss deprecated packages but keep hidden packag= es. > + #:select? (negate package-superseded)))) Oh! This is a better implementation, indeed. :-) LGTM. Cheers, simon