From patchwork Wed May 14 20:23:45 2025 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: 42613 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 82DEE27BC4C; Wed, 14 May 2025 21:26:13 +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=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, 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 D71C927BC49 for ; Wed, 14 May 2025 21:26:05 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uFIft-0004C8-8i; Wed, 14 May 2025 16:25:57 -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 1uFIf2-0001kK-Sx for guix-patches@gnu.org; Wed, 14 May 2025 16:25:12 -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 1uFIf2-0006dx-Gb; Wed, 14 May 2025 16:25:04 -0400 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:From:To:Subject; bh=BlNigzXycwlX5Nc/mdRj5/apnWXeAJRouV7Ps7v4kHo=; b=QiF8PU6Khc+/+/FErnuwLJFAgD2T1eWVOBOz8tY+4hGkrJk+aRBe2uI0IIlKeZTeg6KgYqOvjexNv1tBgy+SPvQ71JiB5p3IqLYStmtgAFw9ixd4WQgPvlgRHeTr0KXLMYVSf8WSy81nPBy2ee9Ljun10iDX7Y64145CREiR7nsQA9u7JibDG33tnRy5WCR/ekuD64gH4zE3Wcl8RL+lLOKYeaimMGscJoPJ7g/bEGeRh8oKCdAf4xq3tU21Nuj+7Q0nygO3KdYKjPWEz3PpCnl4Z8l9h6XV0ZF/fgmL8fl6LO18bgVIvdATzWox7OFhX3TDPEBCeaAY/KUpthpngQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uFIf0-0002Uy-14; Wed, 14 May 2025 16:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78432] [PATCH 1/2] channels: Speed up =?utf-8?b?4oCYY2hhbm5l?= =?utf-8?b?bC1uZXdzLWZvci1jb21taXTigJku?= 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, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Wed, 14 May 2025 20:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78432 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78432@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Ian Eure , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.17472542549225 (code B ref -1); Wed, 14 May 2025 20:25:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 May 2025 20:24:14 +0000 Received: from localhost ([127.0.0.1]:46096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uFIeD-0002Oc-9J for submit@debbugs.gnu.org; Wed, 14 May 2025 16:24:14 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56014) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uFIeA-0002NT-Ey for submit@debbugs.gnu.org; Wed, 14 May 2025 16:24:11 -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 1uFIe4-00083L-Qy for guix-patches@gnu.org; Wed, 14 May 2025 16:24:05 -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 1uFIe4-0006SO-5o; Wed, 14 May 2025 16:24:04 -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=BlNigzXycwlX5Nc/mdRj5/apnWXeAJRouV7Ps7v4kHo=; b=X7HfFuYYISWerz daIli+pPKysijFtx0kzOJzKdsCwIqzsoD61FHg5ziGy9/Q9dXGkdC1+bqWs1N/eTLiZoKNAQciz+1 8Y+y+cP3csLZzlaCWLtoqi4RUmZqMAF4NTO9s+lA+hWQW13gJ7Wk5F+40wvfV9q00e8bIzBXBz5WY sGvcBYhJCHIu4K9I8n89B0cHZM1iNC2LrrtgMU2najbX7dLWn4YdyS5O7LCYGDe6PIYQ2yO0CZKs3 PbVhrhm5Rn95an/JyfW4nkcSq3ApJauyLay6pLA2yYjdqUj4NpsNkPbnu0L7VEKB/8IT4omBuSyLt sMIq1kYzLhXy6KqoZkrg==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 14 May 2025 22:23:45 +0200 Message-ID: <9d07f070500e61169450678b48983454508636f8.1747254136.git.ludo@gnu.org> X-Mailer: git-send-email 2.49.0 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 Partly fixes . This makes the wall-clock time of: guix pull --list-generations > /dev/null shrink from 33s to 4s on a profile with 8 generations. * guix/channels.scm (channel-news-for-commit): Rewrite in terms of ‘commit-descendant?’. Reported-by: Ian Eure Change-Id: I387e3dc37437e2d98bfd7ab710417f68d16146ad --- guix/channels.scm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) base-commit: c5265b90b055ee15908298c5d463301f1aae2eb1 diff --git a/guix/channels.scm b/guix/channels.scm index 7a02d24a84..f6b3f40cc3 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018-2024 Ludovic Courtès +;;; Copyright © 2018-2025 Ludovic Courtès ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2021 Brice Waegeneire @@ -31,7 +31,7 @@ (define-module (guix channels) #:autoload (git structs) (git-error-code) #:autoload (guix git) (update-cached-checkout url+commit->name - commit-difference + commit-descendant? repository-info commit-short-id tag->commit @@ -48,7 +48,6 @@ (define-module (guix channels) #:use-module (guix progress) #:use-module (guix derivations) #:use-module (guix diagnostics) - #:use-module (guix sets) #:use-module (guix store) #:use-module (guix i18n) #:use-module (srfi srfi-1) @@ -1237,15 +1236,16 @@ (define* (channel-news-for-commit channel new #:optional old) entry)) (channel-news-entries news)))) (if old - (let* ((new (commit-lookup repository (string->oid new))) - (old (commit-lookup repository (string->oid old))) - (commits (list->set - (map (compose oid->string commit-id) - (commit-difference new old))))) - (filter (lambda (entry) - (set-contains? commits - (channel-news-entry-commit entry))) - entries)) + (let ((new (commit-lookup repository (string->oid new))) + (old (commit-lookup repository (string->oid old)))) + (take-while (lambda (entry) + (let ((entry (commit-lookup + repository + (string->oid + (channel-news-entry-commit entry))))) + (and (commit-descendant? new (list entry)) + (not (commit-descendant? old (list entry)))))) + entries)) entries))) '()))) (lambda (key error . rest)