unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#46100] [PATCH 0/4] Memoize inferior package access.
@ 2021-01-25 13:33 Ricardo Wurmus
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2021-01-25 13:33 UTC (permalink / raw)
  To: 46100

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

Hi Guix,

this patch set improves performance of inferior lookups by caching previous
results.  The change in inferior-package->manifest-entry has the biggest
impact in my test case, where I'm building a profile consisting of a few R
packages.  Without this patch it takes more than 14 seconds.  With cached
results it takes less than a second.

Included is a patch that Ludo provided on #guix-hpc for which I wrote a
commit message.

The test case is attached.

Ludovic Courtès (1):
  inferior: Memoize package input field access.

Ricardo Wurmus (3):
  guix: Fix typo.
  inferior: Memoize inferior-package->manifest-entry.
  inferior: Memoize inferior package search path access.

 guix/inferior.scm | 155 ++++++++++++++++++++++++----------------------
 1 file changed, 81 insertions(+), 74 deletions(-)


base-commit: 90a6ce0b1852608185e3ba7fe09e585b43eac3be
-- 
2.29.2


-- 
Ricardo


[-- Attachment #2: inferior-slow.scm --]
[-- Type: text/plain, Size: 1371 bytes --]

(import (guix packages)
        (guix inferior)
        (guix store)
        (guix monads)(guix gexp)
        (guix profiles)
        (guix derivations)
        (ice-9 match)
        (srfi srfi-19))

(pk 'current-guix)
(define current-guix
  ;; /home/rekado/.config/guix/current
  (let* ((default-guix "/gnu/store/ig6alp71w39bmfy51f1w32z0k2rbh6ra-profile")
         (current-guix-inferior #false))
    (lambda ()
      (or current-guix-inferior
          (begin
            (set! current-guix-inferior (open-inferior
                                         (canonicalize-path default-guix)))
            current-guix-inferior)))))

(define (lookup-package specification)
  (match (lookup-inferior-packages (current-guix) specification)
    ((first . rest) first)
    (x (error "oops" x))))

(define specs
  (list "bash-minimal"
        "r-minimal"
        "r-ggplot2"
        "r-ggrepel"
        "r-deseq2"
        "r-dt"
        "r-pheatmap"
        "r-corrplot"
        "r-reshape2"
        "r-plotly"
        "r-scales"
        "r-crosstalk"
        "r-gprofiler"
        "r-rtracklayer"
        "r-summarizedexperiment"))

(pk 'packages)
(define packages
  (map lookup-package specs))

(pk 'packages->manifest)
(let ((start (current-time)))
  (let ((manifest (packages->manifest packages)))
    (pk 'packages->manifest-done (time-difference (current-time) start))))

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [bug#46101] [PATCH 1/4] guix: Fix typo.
@ 2021-01-25 13:37 Ricardo Wurmus
  2021-01-25 13:37 ` [bug#46102] [PATCH 2/4] inferior: Memoize inferior-package->manifest-entry Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2021-01-25 13:37 UTC (permalink / raw)
  To: 46100, 46101

* guix/inferior.scm (inferior-available-packages): Remove extra word in
docstring.
---
 guix/inferior.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index 2fe91beaab..da6983d9a6 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -311,8 +311,7 @@ Raise '&inferior-exception' when an exception is read from PORT."
   "Return the list of name/version pairs corresponding to the set of packages
 available in INFERIOR.
 
-This is faster and requires less resource-intensive than calling
-'inferior-packages'."
+This is faster and less resource-intensive than calling 'inferior-packages'."
   (if (inferior-eval '(defined? 'fold-available-packages)
                      inferior)
       (inferior-eval '(fold-available-packages
-- 
2.29.2






^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-28 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-25 13:33 [bug#46100] [PATCH 0/4] Memoize inferior package access Ricardo Wurmus
  -- strict thread matches above, loose matches on Subject: below --
2021-01-25 13:37 [bug#46101] [PATCH 1/4] guix: Fix typo Ricardo Wurmus
2021-01-25 13:37 ` [bug#46102] [PATCH 2/4] inferior: Memoize inferior-package->manifest-entry Ricardo Wurmus
2021-01-26 10:41   ` [bug#46100] [PATCH 0/4] Memoize inferior package access Ludovic Courtès
2021-01-26 11:30     ` Ludovic Courtès
2021-01-26 12:38       ` Ricardo Wurmus
2021-01-27 23:18         ` Ludovic Courtès
2021-01-28 11:53           ` Ricardo Wurmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).