me
/
guix
Archived
1
0
Fork 0

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.
master
Ludovic Courtès 2019-07-03 23:29:17 +02:00
parent e85a7b7f8c
commit dd0ee954c4
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 9 additions and 3 deletions

View File

@ -1783,6 +1783,9 @@ the store."
;; when using 'gexp->derivation' and co. ;; when using 'gexp->derivation' and co.
(make-parameter #f)) (make-parameter #f))
(define set-store-connection-object-cache!
(record-modifier <store-connection> 'object-cache))
(define* (run-with-store store mval (define* (run-with-store store mval
#:key #:key
(guile-for-build (%guile-for-build)) (guile-for-build (%guile-for-build))
@ -1798,9 +1801,12 @@ connection, and return the result."
(%current-target-system target)) (%current-target-system target))
(call-with-values (lambda () (call-with-values (lambda ()
(run-with-state mval store)) (run-with-state mval store))
(lambda (result store) (lambda (result new-store)
;; Discard the state. ;; Copy the object cache from NEW-STORE so we don't fully discard the
result)))) ;; state.
(let ((cache (store-connection-object-cache new-store)))
(set-store-connection-object-cache! store cache)
result)))))
;;; ;;;