summaryrefslogtreecommitdiff
path: root/guix/store.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-02-19 22:30:30 +0100
committerLudovic Courtès <ludo@gnu.org>2021-02-23 15:24:49 +0100
commit0a912b3a434c9ff9515f9036feae4d3a7075fb2f (patch)
treeeb439e0465a690bd087e8ca932a05f2a8e67fe1b /guix/store.scm
parentfcde4e10b87db9a71dbc115af548aeabe9068310 (diff)
store: Micro-optimize object cache lookup.
This avoids a closure allocation when 'lookup-cached-object' is called. * guix/store.scm (lookup-cached-object): Avoid optional/keyword arguments and inline. (%mcached): Adjust accordingly.
Diffstat (limited to 'guix/store.scm')
-rw-r--r--guix/store.scm5
1 files changed, 2 insertions, 3 deletions
diff --git a/guix/store.scm b/guix/store.scm
index dccf8ba1d9..37ae6cfedd 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -1863,8 +1863,7 @@ and RESULT is typically its derivation."
(lambda (x y)
#t)))
-(define* (lookup-cached-object object #:optional (keys '())
- #:key (vhash-fold* vhash-foldq*))
+(define-inlinable (lookup-cached-object object keys vhash-fold*)
"Return the cached object in the store connection corresponding to OBJECT
and KEYS; use VHASH-FOLD* to look for OBJECT in the cache. KEYS is a list of
additional keys to match against, and which are compared with 'equal?'.
@@ -1895,7 +1894,7 @@ Return #f on failure and the cached result otherwise."
OBJECT/KEYS, or return its cached value. Use VHASH-CONS to insert OBJECT into
the cache, and VHASH-FOLD* to look it up."
(mlet %store-monad ((cached (lookup-cached-object object keys
- #:vhash-fold* vhash-fold*)))
+ vhash-fold*)))
(if cached
(return cached)
(>>= (mthunk)