[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/11: size: Optimize dependency size computation.
From: |
guix-commits |
Subject: |
01/11: size: Optimize dependency size computation. |
Date: |
Sun, 7 Apr 2019 12:06:12 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 1199da08aa76f7bba57692b4b8e9272fd305e9f2
Author: Ludovic Courtès <address@hidden>
Date: Sat Apr 6 14:52:56 2019 +0200
size: Optimize dependency size computation.
This reduces 'guix size' run time by ~4% here:
items="$(guix build icecat inkscape emacs libreoffice)"
guix size $items
* guix/scripts/size.scm (store-profile): Define 'size-table' and use it
to lookup the size of ITEM in 'dependency-size'.
---
guix/scripts/size.scm | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm
index 25218a2..f549ce0 100644
--- a/guix/scripts/size.scm
+++ b/guix/scripts/size.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -34,6 +34,7 @@
#:use-module (srfi srfi-37)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
+ #:use-module (ice-9 vlist)
#:export (profile?
profile-file
profile-self-size
@@ -142,11 +143,20 @@ profile of ITEMS and their requisites."
(lambda (size)
(return (cons item size)))))
refs)))
+ (define size-table
+ (fold (lambda (pair result)
+ (match pair
+ ((item . size)
+ (vhash-cons item size result))))
+ vlist-null sizes))
+
(define (dependency-size item)
(mlet %store-monad ((deps (requisites* (list item))))
(foldm %store-monad
(lambda (item total)
- (return (+ (assoc-ref sizes item) total)))
+ (return (+ (match (vhash-assoc item size-table)
+ ((_ . size) size))
+ total)))
0
(delete-duplicates (cons item deps)))))
- branch master updated (32c055f -> 71b4974), guix-commits, 2019/04/07
- 01/11: size: Optimize dependency size computation.,
guix-commits <=
- 03/11: installer: Simplify locale dialogs., guix-commits, 2019/04/07
- 07/11: installer: Remove SLiM-specific instructions., guix-commits, 2019/04/07
- 02/11: doc: Fix syntax of cross-manual references., guix-commits, 2019/04/07
- 05/11: installer: Use the normalized codeset in the 'locale' field., guix-commits, 2019/04/07
- 06/11: installer: Fix wording for "Internet access.", guix-commits, 2019/04/07
- 08/11: installer: Generalize desktop environments to system services., guix-commits, 2019/04/07
- 11/11: gnu: address@hidden: Move to ssh.scm., guix-commits, 2019/04/07
- 10/11: services: dropbear: Add default value., guix-commits, 2019/04/07
- 04/11: installer: Move the 'locale' step before the 'welcome' step., guix-commits, 2019/04/07
- 09/11: installer: Add dialog to select networking services., guix-commits, 2019/04/07