[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
10/15: derivations: 'derivation' preserves pointer equality.
From: |
guix-commits |
Subject: |
10/15: derivations: 'derivation' preserves pointer equality. |
Date: |
Thu, 27 Jun 2019 05:15:46 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit fd951cd543d9f4d3ecfa4570e51797f84e79068b
Author: Ludovic Courtès <address@hidden>
Date: Sun Jun 23 11:40:16 2019 +0200
derivations: 'derivation' preserves pointer equality.
* guix/derivations.scm (derivation): Check if FILE is already in
%DERIVATION-CACHE and return it if it is.
---
guix/derivations.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 5c568f2..403e867 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -873,8 +873,12 @@ derivation. It is kept as-is, uninterpreted, in the
derivation."
(append (map derivation-input-path inputs)
sources)))
(drv* (set-field drv (derivation-file-name) file)))
- (hash-set! %derivation-cache file drv*)
- drv*)))
+ ;; Preserve pointer equality. This improves the performance of
+ ;; 'eq?'-memoization on derivations.
+ (or (hash-ref %derivation-cache file)
+ (begin
+ (hash-set! %derivation-cache file drv*)
+ drv*)))))
(define (invalidate-derivation-caches!)
"Invalidate internal derivation caches. This is mostly useful for
- 01/15: accounts: Use 'fsync' instead of 'fdatasync'., (continued)
- 01/15: accounts: Use 'fsync' instead of 'fdatasync'., guix-commits, 2019/06/27
- 03/15: syscalls: Add 'terminal-rows'., guix-commits, 2019/06/27
- 06/15: derivations: Rewrite and replace 'derivations-prerequisites-to-build'., guix-commits, 2019/06/27
- 04/15: ui: Add 'display-search-results' and use it., guix-commits, 2019/06/27
- 02/15: ui: 'relevance' considers regexps connected with a logical and., guix-commits, 2019/06/27
- 11/15: derivations: 'build-derivations' can be passed derivation inputs., guix-commits, 2019/06/27
- 05/15: derivations: Add 'derivation-input'., guix-commits, 2019/06/27
- 15/15: tests: Avoid TCP port collision between lint.scm and guix-daemon.sh., guix-commits, 2019/06/27
- 13/15: ui: 'show-what-to-build' accepts derivation inputs., guix-commits, 2019/06/27
- 09/15: derivations: <derivation-input> now aggregates a <derivation>., guix-commits, 2019/06/27
- 10/15: derivations: 'derivation' preserves pointer equality.,
guix-commits <=
- 08/15: graph: Use 'derivation-input-derivation'., guix-commits, 2019/06/27
- 07/15: ui: 'show-what-to-build' uses 'derivation-build-plan'., guix-commits, 2019/06/27
- 14/15: ui: 'show-derivation-outputs' accepts <derivation-input> records., guix-commits, 2019/06/27
- 12/15: packages: 'specification->package+output' distinguishes "no output specified"., guix-commits, 2019/06/27