aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-10-27 19:12:11 +0100
committerLudovic Courtès <ludo@gnu.org>2019-10-27 23:05:00 +0100
commitf5fca9a82cec76d2e10b8b6c96be2dd79f638ba0 (patch)
tree96ad0f5143c44fc8a358943da7f541748b05cdaf
parentc57e417eff8649fce44041bc8e187a3e0c91b801 (diff)
downloadguix-f5fca9a82cec76d2e10b8b6c96be2dd79f638ba0.tar
guix-f5fca9a82cec76d2e10b8b6c96be2dd79f638ba0.tar.gz
gexp: Cache the module to derivation mappings.
This reduces the number of 'add-data-to-store' cache lookups from 3329 to 2743 (hit rate: 27% to 11%) when running: GUIX_PROFILING=add-data-to-store-cache guix build libreoffice -nd Execution time of "guix build libreoffice -nd" goes from 1.86s to 1.80s. * guix/gexp.scm (imported+compiled-modules): Wrap body in 'mcached'.
-rw-r--r--guix/gexp.scm33
1 files changed, 18 insertions, 15 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index fa74e80cd6..b640c079e4 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -660,21 +660,24 @@ names and file names suitable for the #:allowed-references argument to
(module-path %load-path))
"Return a pair where the first element is the imported MODULES and the
second element is the derivation to compile them."
- (mlet %store-monad ((modules (if (pair? modules)
- (imported-modules modules
- #:system system
- #:module-path module-path)
- (return #f)))
- (compiled (if (pair? modules)
- (compiled-modules modules
- #:system system
- #:module-path module-path
- #:extensions extensions
- #:guile guile
- #:deprecation-warnings
- deprecation-warnings)
- (return #f))))
- (return (cons modules compiled))))
+ (mcached equal?
+ (mlet %store-monad ((modules (if (pair? modules)
+ (imported-modules modules
+ #:system system
+ #:module-path module-path)
+ (return #f)))
+ (compiled (if (pair? modules)
+ (compiled-modules modules
+ #:system system
+ #:module-path module-path
+ #:extensions extensions
+ #:guile guile
+ #:deprecation-warnings
+ deprecation-warnings)
+ (return #f))))
+ (return (cons modules compiled)))
+ modules
+ system extensions guile deprecation-warnings module-path))
(define* (lower-gexp exp
#:key