derivations: Reduce 'valid-path?' RPCs in 'derivation-prerequisites-to-build'.

On a profile with 280 packages, this reduces the number of
'valid-paths?' RPCs made by 'guix package -nu' from 6K to 500.

* guix/derivations.scm (derivation-prerequisites-to-build)[built?]:
Memoize 'valid-path?' calls.
This commit is contained in:
Ludovic Courtès 2019-04-16 11:42:18 +02:00
parent 3961edf230
commit e856177597
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of GNU Guix.
@ -344,7 +344,8 @@ OUTPUTS of DRV and not already available in STORE, recursively, and the list
of required store paths that can be substituted. SUBSTITUTABLE-INFO must be a
one-argument procedure similar to that returned by 'substitution-oracle'."
(define built?
(cut valid-path? store <>))
(mlambda (item)
(valid-path? store item)))
(define input-built?
(compose (cut any built? <>) derivation-input-output-paths))