summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-04-02 16:01:32 +0200
committerLudovic Courtès <ludo@gnu.org>2014-04-02 16:07:40 +0200
commit27c68457d992895833a7b0a833679dc2efc9e188 (patch)
tree925e2f1ed5729dca33e143d4832d02b49f397920
parentd2952326ae18f50f6b3abefe0b12547556f9a1b8 (diff)
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.)
-rw-r--r--guix/scripts/package.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 36d47348f1..d4309094e8 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -417,8 +417,11 @@ current settings and report only settings not already effective."
(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)))))