GNU bug report logs - #46100
[PATCH 0/4] Memoize inferior package access.

Previous Next

Package: guix-patches;

Reported by: Ricardo Wurmus <rekado <at> elephly.net>

Date: Mon, 25 Jan 2021 13:35:02 UTC

Severity: normal

Tags: patch

Merged with 46101, 46102

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ricardo Wurmus <rekado <at> elephly.net>
Subject: bug#46102: closed (Re: bug#46100: [PATCH 0/4] Memoize inferior
 package access.)
Date: Thu, 28 Jan 2021 13:17:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#46100: [PATCH 2/4] inferior: Memoize inferior-package->manifest-entry.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 46102 <at> debbugs.gnu.org.

-- 
46100: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=46100
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: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 46100-done <at> debbugs.gnu.org
Subject: Re: bug#46100: [PATCH 0/4] Memoize inferior package access.
Date: Thu, 28 Jan 2021 14:16:47 +0100
Ricardo Wurmus <rekado <at> elephly.net> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> I pushed it as 0f20b3fa2050ba6e442e340a204516b9375cd231.
>
> Thanks!
>
>> I wonder if the other patches improve the situation.  If you run the
>> same test case with:
>>
>>   GUIX_PROFILING=memoization
>>
>> what hit rates does it show for these spots?
>
> Memoization: 15 tables, 2 non-empty
>   guix/inferior.scm:438:2: 	403 entries, 403 lookups, 0% hits
>   guix/inferior.scm:392:2: 	403 entries, 403 lookups, 0% hits
>
> So, I guess we can drop those two patches.

Looks like it.  :-)

Closing!

Thanks,
Ludo’.

[Message part 3 (message/rfc822, inline)]
From: Ricardo Wurmus <rekado <at> elephly.net>
To: 46100 <at> debbugs.gnu.org,
	guix-patches <at> gnu.org
Cc: Ricardo Wurmus <rekado <at> elephly.net>
Subject: [PATCH 2/4] inferior: Memoize inferior-package->manifest-entry.
Date: Mon, 25 Jan 2021 14:37:36 +0100
* guix/inferior.scm (inferior-package->manifest-entry): Memoize.
---
 guix/inferior.scm | 55 ++++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 25 deletions(-)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index da6983d9a6..7bfce5d810 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2021 Ricardo Wurmus <rekado <at> elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -639,31 +640,35 @@ failing when GUIX is too old and lacks the 'guix repl' command."
 ;;; Manifest entries.
 ;;;
 
-(define* (inferior-package->manifest-entry package
-                                           #:optional (output "out")
-                                           #:key (parent (delay #f))
-                                           (properties '()))
-  "Return a manifest entry for the OUTPUT of package PACKAGE."
-  ;; For each dependency, keep a promise pointing to its "parent" entry.
-  (letrec* ((deps  (map (match-lambda
-                          ((label package)
-                           (inferior-package->manifest-entry package
-                                                             #:parent (delay entry)))
-                          ((label package output)
-                           (inferior-package->manifest-entry package output
-                                                             #:parent (delay entry))))
-                        (inferior-package-propagated-inputs package)))
-            (entry (manifest-entry
-                     (name (inferior-package-name package))
-                     (version (inferior-package-version package))
-                     (output output)
-                     (item package)
-                     (dependencies (delete-duplicates deps))
-                     (search-paths
-                      (inferior-package-transitive-native-search-paths package))
-                     (parent parent)
-                     (properties properties))))
-    entry))
+(define inferior-package->manifest-entry
+  (let ((results vlist-null))
+    (lambda* (package #:optional (output "out")
+                      #:key (parent (delay #f))
+                      (properties '()))
+      "Return a manifest entry for the OUTPUT of package PACKAGE."
+      (or (and=> (vhash-assoc package results) cdr)
+          ;; For each dependency, keep a promise pointing to its "parent" entry.
+          (letrec* ((deps  (map (match-lambda
+                                  ((label package)
+                                   (inferior-package->manifest-entry package
+                                                                     #:parent (delay entry)))
+                                  ((label package output)
+                                   (inferior-package->manifest-entry package output
+                                                                     #:parent (delay entry))))
+                                (inferior-package-propagated-inputs package)))
+                    (entry (manifest-entry
+                             (name (inferior-package-name package))
+                             (version (inferior-package-version package))
+                             (output output)
+                             (item package)
+                             (dependencies (delete-duplicates deps))
+                             (search-paths
+                              (inferior-package-transitive-native-search-paths package))
+                             (parent parent)
+                             (properties properties))))
+            (begin
+              (set! results (vhash-cons package entry results))
+              entry))))))
 
 
 ;;;
-- 
2.29.2





This bug report was last modified 4 years and 170 days ago.

Previous Next


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