GNU bug report logs - #78432
[PATCH 1/2] channels: Speed up ‘channel-news-for-commit’.

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Wed, 14 May 2025 20:25:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#78432: closed ([PATCH 1/2] channels: Speed up ‘channel-news-for-commit’.)
Date: Sun, 18 May 2025 21:05:04 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 18 May 2025 23:02:08 +0200
with message-id <87v7pxk4z3.fsf <at> gnu.org>
and subject line Re: [bug#78432] [PATCH 2/2] git: Remove code for Guile-Git < 0.10.0.
has caused the debbugs.gnu.org bug report #78432,
regarding [PATCH 1/2] channels: Speed up ‘channel-news-for-commit’.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
78432: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78432
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Ian Eure <ian <at> retrospec.tv>
Subject: [PATCH 1/2] channels: Speed up ‘channel-news-for-commit’.
Date: Wed, 14 May 2025 22:23:45 +0200
Partly fixes <https://issues.guix.gnu.org/78194>.

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 <ian <at> retrospec.tv>
Change-Id: I387e3dc37437e2d98bfd7ab710417f68d16146ad
---
 guix/channels.scm | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

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 <ludo <at> gnu.org>
+;;; Copyright © 2018-2025 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
 ;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
@@ -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)

base-commit: c5265b90b055ee15908298c5d463301f1aae2eb1
-- 
2.49.0



[Message part 3 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Ian Eure <ian <at> retrospec.tv>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, 78432-done <at> debbugs.gnu.org,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#78432] [PATCH 2/2] git: Remove code for Guile-Git < 0.10.0.
Date: Sun, 18 May 2025 23:02:08 +0200
Hi,

Ian Eure <ian <at> retrospec.tv> writes:

> Both patches LGTM!

Thanks for taking a look.  Pushed:

  86022e994e * git: Remove code for Guile-Git < 0.10.0.
  6d6d897b54 * channels: Speed up ‘channel-news-for-commit’.

Ludo’.


This bug report was last modified 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.