unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: 46100@debbugs.gnu.org
Subject: [bug#46100] [PATCH 0/4] Memoize inferior package access.
Date: Mon, 25 Jan 2021 14:33:59 +0100	[thread overview]
Message-ID: <87k0s1jg3c.fsf@elephly.net> (raw)

[-- 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))))

             reply	other threads:[~2021-01-25 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 13:33 Ricardo Wurmus [this message]
  -- 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0s1jg3c.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=46100@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).