From 6491e3587f1f29a97b46585fb0624486a8e058c4 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 17 Nov 2023 11:38:07 +0000 Subject: Avoid readlink syscalls when reading derivations strace -c reports over 10,000 readlink syscalls when reading the derivation for the hello package. By just setting the %file-port-name-canonicalization fluid, this drops to less than 10. I'm not sure if this actually improves performance, but doing less is surely better. --- guix-build-coordinator/utils.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index fdd7ee3..1d5ddbd 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -474,8 +474,12 @@ context." ;; avoid having many open files when reading a derivation with ;; inputs, read it in to a string first. (call-with-input-string - (call-with-input-file file - get-string-all) + ;; Avoid calling scm_i_relativize_path in + ;; fport_canonicalize_filename since this leads to lots + ;; of readlink calls + (with-fluids ((%file-port-name-canonicalization 'none)) + (call-with-input-file file + get-string-all)) (lambda (port) (set-port-filename! port file) (read-derivation port read-derivation-from-file*))))) -- cgit v1.2.3