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
d38bc9a9f6.

* guix/grafts.scm (with-cache): In the miss case, call 'current-state'
after EXP has been evaluated.
This commit is contained in:
Ludovic Courtès 2017-01-16 22:05:43 +01:00
parent 90ad5c8836
commit 0aeed5e310
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 2 additions and 1 deletions

View File

@ -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)))))))