[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/04: derivations: Inline 'find' in 'coalesce-duplicate-inputs'.
From: |
guix-commits |
Subject: |
02/04: derivations: Inline 'find' in 'coalesce-duplicate-inputs'. |
Date: |
Thu, 23 Jan 2020 17:37:00 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 370891d5655a92eda596df5a03abed53511df386
Author: Ludovic Courtès <address@hidden>
AuthorDate: Thu Jan 23 22:35:43 2020 +0100
derivations: Inline 'find' in 'coalesce-duplicate-inputs'.
Previously the first argument to 'find' would show up high in profiles
of 'package-derivation'. This speeds things up a big, especially on
Guile 3.
* guix/derivations.scm (coalesce-duplicate-inputs)[find]: New
procedure.
---
guix/derivations.scm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 480a65c..f6d6f7d 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès
<address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic
Courtès <address@hidden>
;;; Copyright © 2016, 2017 Mathieu Lirzin <address@hidden>
;;;
;;; This file is part of GNU Guix.
@@ -240,6 +240,13 @@ the store."
"Return a list of inputs, such that when INPUTS contains the same DRV twice,
they are coalesced, with their sub-derivations merged. This is needed because
Nix itself keeps only one of them."
+ (define (find pred lst) ;inlinable copy of 'find'
+ (let loop ((lst lst))
+ (match lst
+ (() #f)
+ ((head . tail)
+ (if (pred head) head (loop tail))))))
+
(fold (lambda (input result)
(match input
(($ <derivation-input> (= derivation-file-name path) sub-drvs)