From 27c68457d992895833a7b0a833679dc2efc9e188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 2 Apr 2014 16:01:32 +0200 Subject: [PATCH] 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.) --- guix/scripts/package.scm | 7 +++++-- 1 file 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 (($ 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)))))