aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-11-17 11:38:07 +0000
committerChristopher Baines <mail@cbaines.net>2023-11-17 11:38:07 +0000
commit6491e3587f1f29a97b46585fb0624486a8e058c4 (patch)
treecb1e0edcc47900884f904ddf5995f2b6e220545f
parent5392d396d98a1b94854c2446a39794495a4afb0c (diff)
downloadbuild-coordinator-6491e3587f1f29a97b46585fb0624486a8e058c4.tar
build-coordinator-6491e3587f1f29a97b46585fb0624486a8e058c4.tar.gz
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.
-rw-r--r--guix-build-coordinator/utils.scm8
1 files 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*)))))