[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
16/17: gexp: Do not add derivations to the object cache.
From: |
guix-commits |
Subject: |
16/17: gexp: Do not add derivations to the object cache. |
Date: |
Mon, 22 Mar 2021 18:02:40 -0400 (EDT) |
civodul pushed a commit to branch wip-build-systems-gexp
in repository guix.
commit f9d07746bc385622ea8fd53e3d3c3726d1e6ffbf
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Mar 22 22:34:43 2021 +0100
gexp: Do not add derivations to the object cache.
That was needlessly making the object cache grow.
* guix/gexp.scm (lower-object, lower+expand-object): Bypass the object
cache when OBJ is a derivation. This almost halves the number of
cache lookups and reduces the number of entries from 3.4K to 2.6K when
doing "guix build libreoffice -d --no-grafts".
---
guix/gexp.scm | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/guix/gexp.scm b/guix/gexp.scm
index ab83c1e..142717e 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -258,14 +258,17 @@ OBJ must be an object that has an associated gexp
compiler, such as a
(#f
(raise (condition (&gexp-input-error (input obj)))))
(lower
- ;; Cache in STORE the result of lowering OBJ.
- (mcached (mlet %store-monad ((lowered (lower obj system target)))
- (if (and (struct? lowered)
- (not (derivation? lowered)))
- (loop lowered)
- (return lowered)))
- obj
- system target graft?))))))
+ ;; Cache in STORE the result of lowering OBJ. If OBJ is a
+ ;; derivation, bypass the cache.
+ (if (derivation? obj)
+ (return obj)
+ (mcached (mlet %store-monad ((lowered (lower obj system target)))
+ (if (and (struct? lowered)
+ (not (derivation? lowered)))
+ (loop lowered)
+ (return lowered)))
+ obj
+ system target graft?)))))))
(define* (lower+expand-object obj
#:optional (system (%current-system))
@@ -280,9 +283,11 @@ expand to file names, but it's possible to expand to a
plain data type."
(raise (condition (&gexp-input-error (input obj)))))
(lower
(mlet* %store-monad ((graft? (grafting?))
- (lowered (mcached (lower obj system target)
- obj
- system target graft?)))
+ (lowered (if (derivation? obj)
+ (return obj)
+ (mcached (lower obj system target)
+ obj
+ system target graft?))))
;; LOWER might return something that needs to be further
;; lowered.
(if (struct? lowered)
- 01/17: gexp: Add 'with-build-variables'., (continued)
- 01/17: gexp: Add 'with-build-variables'., guix-commits, 2021/03/22
- 03/17: build-system: Rewrite using gexps., guix-commits, 2021/03/22
- 04/17: packages: Turn 'bag->derivation' into a monadic procedure., guix-commits, 2021/03/22
- 05/17: packages: Simplify patch instantiation., guix-commits, 2021/03/22
- 02/17: gexp: Optimize 'with-build-variables'., guix-commits, 2021/03/22
- 07/17: packages: Default origin 'patch-flags' is a gexp., guix-commits, 2021/03/22
- 12/17: packages: 'expand-input' accepts any file-like object., guix-commits, 2021/03/22
- 13/17: packages: Call 'bag-grafts' only on the tip of the package graph., guix-commits, 2021/03/22
- 06/17: packages: Core procedures are written in monadic style., guix-commits, 2021/03/22
- 08/17: gexp: Add 'sexp->gexp'., guix-commits, 2021/03/22
- 16/17: gexp: Do not add derivations to the object cache.,
guix-commits <=
- 17/17: gnu: docbook-xsl: Move 'use-modules' form to the top level., guix-commits, 2021/03/22
- 10/17: build-system: Use 'input-tuples->gexp' and 'outputs->gexp'., guix-commits, 2021/03/22
- 09/17: build-system: Use 'sexp->gexp' for plain sexps., guix-commits, 2021/03/22
- 11/17: packages: '%standard-patch-inputs' is not influenced by '%current-target-system'., guix-commits, 2021/03/22
- 15/17: gexp: Allowed/disallowed references and graphs never refer to grafted inputs., guix-commits, 2021/03/22
- 14/17: grafts: Add 'without-grafting'., guix-commits, 2021/03/22