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
1 changed files with 5 additions and 2 deletions

View File

@ -417,8 +417,11 @@ current settings and report only settings not already effective."
(define manifest-entry->package (define manifest-entry->package
(match-lambda (match-lambda
(($ <manifest-entry> name version) (($ <manifest-entry> name version)
(match (append (find-packages-by-name name version) ;; Use 'find-best-packages-by-name' and not 'find-packages-by-name';
(find-packages-by-name 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) ((p _ ...) p)
(_ #f))))) (_ #f)))))