summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-01-16 22:05:43 +0100
committerLudovic Courtès <ludo@gnu.org>2017-01-16 22:13:21 +0100
commit0aeed5e310504a9ef2cf6a2b2a7e76086eb8c2fc (patch)
tree30be573ed389e58aca9dd81bb8add6d59ed22a92
parent90ad5c8836138b7fd4d1bd0243dfa8b30ae0cf21 (diff)
downloadguix-0aeed5e310504a9ef2cf6a2b2a7e76086eb8c2fc.tar.gz
grafts: Preserve the cache across recursive calls.
Before this commit, we'd lose the cache across recursive calls to
'cumulative-grafts', which isn't great performance-wise.

This bug was already present before
d38bc9a9f6feefc465964531520fee5663a12f48.

* guix/grafts.scm (with-cache): In the miss case, call 'current-state'
after EXP has been evaluated.
-rw-r--r--guix/grafts.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/guix/grafts.scm b/guix/grafts.scm
index b60c8cfd90..e14a40f8d1 100644
--- a/guix/grafts.scm
+++ b/guix/grafts.scm
@@ -221,7 +221,8 @@ available."
       ((_ . result)                               ;cache hit
        (return result))
       (#f                                         ;cache miss
-       (mlet %state-monad ((result (begin exp ...)))
+       (mlet %state-monad ((result (begin exp ...))
+                           (cache  (current-state)))
          (mbegin %state-monad
            (set-current-state (vhash-consq key result cache))
            (return result)))))))