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.master
parent
fcde4e10b8
commit
0a912b3a43
|
@ -1863,8 +1863,7 @@ and RESULT is typically its derivation."
|
||||||
(lambda (x y)
|
(lambda (x y)
|
||||||
#t)))
|
#t)))
|
||||||
|
|
||||||
(define* (lookup-cached-object object #:optional (keys '())
|
(define-inlinable (lookup-cached-object object keys vhash-fold*)
|
||||||
#:key (vhash-fold* vhash-foldq*))
|
|
||||||
"Return the cached object in the store connection corresponding to OBJECT
|
"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
|
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?'.
|
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
|
OBJECT/KEYS, or return its cached value. Use VHASH-CONS to insert OBJECT into
|
||||||
the cache, and VHASH-FOLD* to look it up."
|
the cache, and VHASH-FOLD* to look it up."
|
||||||
(mlet %store-monad ((cached (lookup-cached-object object keys
|
(mlet %store-monad ((cached (lookup-cached-object object keys
|
||||||
#:vhash-fold* vhash-fold*)))
|
vhash-fold*)))
|
||||||
(if cached
|
(if cached
|
||||||
(return cached)
|
(return cached)
|
||||||
(>>= (mthunk)
|
(>>= (mthunk)
|
||||||
|
|
Reference in New Issue