aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-03 23:29:17 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-03 23:44:19 +0200
commitdd0ee954c4fa965023fd887452927c02edb8b52f (patch)
tree7954f2167dbf6b86efd58c6593158a280a89c8ac
parente85a7b7f8c6a2ef23b29968b3ddf09d922449c19 (diff)
downloadguix-dd0ee954c4fa965023fd887452927c02edb8b52f.tar
guix-dd0ee954c4fa965023fd887452927c02edb8b52f.tar.gz
store: 'run-with-store' preserves the functional object cache.
This increases the hit rate of the object cache from 56% to 85% when running something like 'guix build libreoffice -nd'. * guix/store.scm (set-store-connection-object-cache!): New procedure. (run-with-store): Copy 'object-cache' field of the new store into the original one.
-rw-r--r--guix/store.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/guix/store.scm b/guix/store.scm
index 8fa16499f8..52940ff751 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -1783,6 +1783,9 @@ the store."
;; when using 'gexp->derivation' and co.
(make-parameter #f))
+(define set-store-connection-object-cache!
+ (record-modifier <store-connection> 'object-cache))
+
(define* (run-with-store store mval
#:key
(guile-for-build (%guile-for-build))
@@ -1798,9 +1801,12 @@ connection, and return the result."
(%current-target-system target))
(call-with-values (lambda ()
(run-with-state mval store))
- (lambda (result store)
- ;; Discard the state.
- result))))
+ (lambda (result new-store)
+ ;; Copy the object cache from NEW-STORE so we don't fully discard the
+ ;; state.
+ (let ((cache (store-connection-object-cache new-store)))
+ (set-store-connection-object-cache! store cache)
+ result)))))
;;;