me
/
guix
Archived
1
0
Fork 0

packages: Optimize 'package-transitive-supported-systems'.

This version is 13% faster than the one above when timing:

  (fold-packages (lambda (p x)
		   (package-transitive-supported-systems p))
		 '())

* guix/packages.scm (package-transitive-supported-systems): Make
'systems' a set instead of calling 'lset-intersection' repeatedly.
master
Ludovic Courtès 2018-07-02 22:15:35 +02:00
parent c729901583
commit 24420f5ffa
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 10 additions and 9 deletions

View File

@ -766,15 +766,16 @@ in INPUTS and their transitive propagated inputs."
(mlambdaq (package) (mlambdaq (package)
"Return the intersection of the systems supported by PACKAGE and those "Return the intersection of the systems supported by PACKAGE and those
supported by its dependencies." supported by its dependencies."
(fold (lambda (input systems) (set->list
(match input (fold (lambda (input systems)
((label (? package? p) . _) (match input
(lset-intersection ((label (? package? p) . _)
string=? systems (package-transitive-supported-systems p))) (fold set-insert systems
(_ (package-transitive-supported-systems p)))
systems))) (_
(package-supported-systems package) systems)))
(bag-direct-inputs (package->bag package))))) (list->set (package-supported-systems package))
(bag-direct-inputs (package->bag package))))))
(define* (supported-package? package #:optional (system (%current-system))) (define* (supported-package? package #:optional (system (%current-system)))
"Return true if PACKAGE is supported on SYSTEM--i.e., if PACKAGE and all its "Return true if PACKAGE is supported on SYSTEM--i.e., if PACKAGE and all its