Subject: bug#46100: closed (Re: bug#46100: [PATCH 0/4] Memoize inferior package access.)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 28 Jan 2021 13:17:02 +0000

Your bug report

#46100: [PATCH 0/4] Memoize inferior package access.

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 [email-masked].

-- 
46100: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=46100
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#46100: [PATCH 0/4] Memoize inferior package access.
From: Ludovic Courtès <[email-masked]>
To: Ricardo Wurmus <[email-masked]>
Cc: [email-masked]
Date: Thu, 28 Jan 2021 14:16:47 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Ricardo Wurmus <[email-masked]> skribis:

> Ludovic Courtès <[email-masked]> 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’.

Subject: [PATCH 0/4] Memoize inferior package access.
From: Ricardo Wurmus <[email-masked]>
To: [email-masked]
Date: Mon, 25 Jan 2021 14:33:59 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

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

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