From: "Ludovic Courtès" <ludo@gnu.org>
To: 55398@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#55398] [PATCH 2/3] packages: Use separate package/graft cache.
Date: Fri, 13 May 2022 17:00:43 +0200 [thread overview]
Message-ID: <20220513150044.11991-2-ludo@gnu.org> (raw)
In-Reply-To: <20220513150044.11991-1-ludo@gnu.org>
* guix/packages.scm (%package-graft-cache): New variable.
(input-graft): Add (=> %package-graft-cache).
---
guix/packages.scm | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index a79b36d03d..7ee65e9b6b 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1618,6 +1618,11 @@ (define* (package->bag package #:optional
(&package-error
(package package))))))))))))
+(define %package-graft-cache
+ ;; Cache mapping <package> records to <graft> records, for packages that
+ ;; have a replacement.
+ (allocate-store-connection-cache 'package-graft-cache))
+
(define (input-graft system)
"Return a monadic procedure that, given a package with a graft, returns a
graft, and #f otherwise."
@@ -1626,9 +1631,8 @@ (define (input-graft system)
(((? package? package) output)
(let ((replacement (package-replacement package)))
(if replacement
- ;; XXX: We should use a separate cache instead of abusing the
- ;; object cache.
- (mcached (mlet %store-monad ((orig (package->derivation package system
+ (mcached eq? (=> %package-graft-cache)
+ (mlet %store-monad ((orig (package->derivation package system
#:graft? #f))
(new (package->derivation replacement system
#:graft? #t)))
@@ -1637,7 +1641,7 @@ (define (input-graft system)
(origin-output output)
(replacement new)
(replacement-output output))))
- package 'graft output system)
+ package output system)
(return #f))))
(_
(return #f)))))
--
2.36.0
next prev parent reply other threads:[~2022-05-13 15:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 14:59 [bug#55398] [PATCH 0/3] Improve store caching; improve 'map/accumulate-builds' performance Ludovic Courtès
2022-05-13 15:00 ` [bug#55398] [PATCH 1/3] store: 'mcached' users can specify a cache ID Ludovic Courtès
2022-05-13 15:00 ` Ludovic Courtès [this message]
2022-05-13 15:00 ` [bug#55398] [PATCH 3/3] store: Use a decaying cutoff in 'map/accumulate-builds' Ludovic Courtès
2022-05-18 22:10 ` bug#55398: [PATCH 0/3] Improve store caching; improve 'map/accumulate-builds' performance Ludovic Courtès
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=20220513150044.11991-2-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=55398@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).