guix package: 'search-path-environment-variables' traverses module tree once.

* guix/scripts/package.scm (search-path-environment-variables)[manifest-entry->package]:
  Use 'find-best-packages-by-name' instead of 'find-packages-by-name'.
  On a profile with 140 packages, this reduces execution time of this
  procedure from 5.8 seconds to 2.9 seconds (50% improvement.)
This commit is contained in:
Ludovic Courtès 2014-04-02 16:01:32 +02:00
parent d2952326ae
commit 27c68457d9

View file

@ -417,8 +417,11 @@ (define* (search-path-environment-variables entries profile
(define manifest-entry->package
(match-lambda
(($ <manifest-entry> name version)
(match (append (find-packages-by-name name version)
(find-packages-by-name name))
;; Use 'find-best-packages-by-name' and not 'find-packages-by-name';
;; the former traverses the module tree only once and then allows for
;; efficient access via a vhash.
(match (or (find-best-packages-by-name name version)
(find-best-packages-by-name name #f))
((p _ ...) p)
(_ #f)))))