me
/
guix
Archived
1
0
Fork 0

packages: Micro-optimize `package-derivation'.

* guix/packages.scm (package-derivation): Move `cache' call before the
  traversal of PACKAGE's inputs.
master
Ludovic Courtès 2012-10-08 21:57:14 +02:00
parent df7bbd3813
commit ead1f1086d
1 changed files with 47 additions and 45 deletions

View File

@ -221,6 +221,13 @@ recursively."
#:optional (system (%current-system)))
"Return the derivation of PACKAGE for SYSTEM."
(or (cached-derivation package system)
;; Compute the derivation and cache the result. Caching is
;; important because some derivations, such as the implicit inputs
;; of the GNU build system, will be queried many, many times in a
;; row.
(cache
package system
(match package
(($ <package> name version source (= build-system-builder builder)
args inputs propagated-inputs native-inputs self-native-input?
@ -254,11 +261,6 @@ recursively."
(input x))))))
(package-transitive-inputs package))))
;; Compute the derivation and cache the result. Caching is
;; important because some derivations, such as the implicit inputs
;; of the GNU build system, will be queried many, many times in a
;; row.
(cache package system
(apply builder
store (package-full-name package)
(and source (package-source-derivation store source))