--- Begin Message ---
Subject: |
[PATCH 0/4] Memoize inferior package access. |
Date: |
Mon, 25 Jan 2021 14:33:59 +0100 |
User-agent: |
mu4e 1.4.13; emacs 27.1 |
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))))
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#46100: [PATCH 0/4] Memoize inferior package access. |
Date: |
Thu, 28 Jan 2021 14:16:47 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Ricardo Wurmus <rekado@elephly.net> skribis:
> Ludovic Courtès <ludo@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’.
--- End Message ---