[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/07: substitute: Avoid repeated calls to 'length'.
From: |
Ludovic Courtès |
Subject: |
02/07: substitute: Avoid repeated calls to 'length'. |
Date: |
Fri, 21 Jul 2017 11:04:13 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 75a4d86f50e1682b96c51eb46a6aba24afc25d03
Author: Ludovic Courtès <address@hidden>
Date: Fri Jul 21 14:13:58 2017 +0200
substitute: Avoid repeated calls to 'length'.
* guix/scripts/substitute.scm (fetch-narinfos)[update-progress!]: Move
'length' call outside of lambda.
---
guix/scripts/substitute.scm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index c066016..35282f9 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -601,13 +601,14 @@ if file doesn't exist, and the narinfo otherwise."
(define (fetch-narinfos url paths)
"Retrieve all the narinfos for PATHS from the cache at URL and return them."
(define update-progress!
- (let ((done 0))
+ (let ((done 0)
+ (total (length paths)))
(lambda ()
(display #\cr (current-error-port))
(force-output (current-error-port))
(format (current-error-port)
(G_ "updating list of substitutes from '~a'... ~5,1f%")
- url (* 100. (/ done (length paths))))
+ url (* 100. (/ done total)))
(set! done (+ 1 done)))))
(define hash-part->path
- branch master updated (0cf9f9b -> c95644f), Ludovic Courtès, 2017/07/21
- 03/07: base32: Export the base32 charsets., Ludovic Courtès, 2017/07/21
- 04/07: publish: Remove 'regexp-exec' call from the hot path., Ludovic Courtès, 2017/07/21
- 05/07: store: Rewrite 'store-path-hash-part' to not use regexps., Ludovic Courtès, 2017/07/21
- 06/07: publish: Avoid 'valid-path?' RPC for non-existent items., Ludovic Courtès, 2017/07/21
- 07/07: publish: Make the cache eviction policy less aggressive., Ludovic Courtès, 2017/07/21
- 01/07: substitute: Optimize hash-part-to-path conversion on non-200 responses., Ludovic Courtès, 2017/07/21
- 02/07: substitute: Avoid repeated calls to 'length'.,
Ludovic Courtès <=