From 14a594a114ea7bb7a53f7a3d1333486348e8b0c0 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 17 Sep 2022 15:10:36 +0200 Subject: Improve the performance of the derivation changes procedures By incorporating the changes made in the branch module. --- guix-qa-frontpage/derivation-changes.scm | 36 ++++++++++++-------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/guix-qa-frontpage/derivation-changes.scm b/guix-qa-frontpage/derivation-changes.scm index 804fb94..ecfb781 100644 --- a/guix-qa-frontpage/derivation-changes.scm +++ b/guix-qa-frontpage/derivation-changes.scm @@ -30,7 +30,7 @@ "") (let ((system (assoc-ref change "system"))) `((,system - . ,(append + . ,(append! (map (lambda (build) `(,@build @@ -59,25 +59,18 @@ (assoc-ref b "version")))) (define (group-builds-by-package builds) - (fold - (lambda (build result) - (let ((package (assoc-ref build "package"))) - `((,package . ,(cons - build - (or - (and=> (find (match-lambda - ((p . _) - (package-eq? p package))) - result) - cdr) - '()))) - ,@(remove - (match-lambda - ((p . _) - (package-eq? p package))) - result)))) - '() - builds)) + (let ((result (make-hash-table))) + (for-each + (lambda (build) + (let ((package (assoc-ref build "package"))) + (hash-set! result + package + (cons build + (or (hash-ref result package) + '()))))) + builds) + + (hash-map->list cons result))) (define systems (map car builds-by-system)) @@ -121,6 +114,3 @@ (filter (lambda (system) (not (member system systems))) all-systems))))) - - - -- cgit v1.2.3