From: Christopher Baines <mail@cbaines.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 67238-close@debbugs.gnu.org
Subject: bug#67238: [PATCH] derivations: Avoid readlink syscalls in read-derivation-from-file.
Date: Sat, 25 Nov 2023 20:58:03 +0000 [thread overview]
Message-ID: <87edgdmtew.fsf@cbaines.net> (raw)
In-Reply-To: <87wmu775lq.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1417 bytes --]
Ludovic Courtès <ludo@gnu.org> writes:
> Hi,
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> 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/derivations.scm (read-derivation-from-file): Set
>> %file-port-name-canonicalization to 'none when calling call-with-input-file.
>>
>> Change-Id: I1ff16a059160576a576f2e9ed881379596e66af3
>
> [...]
>
>> + (let ((drv
>> + ;; 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 read-derivation))))
>
> This is already done in ‘run-guix’ in (guix ui), for all the ‘guix’
> commands (so this patch would be a slight performance regression for
> Guix itself).
>
> I’d suggest setting this fluid globally in applications that use Guix
> (the Build Coordinator, etc.), as is done in Guix itself.
>
> WDYT?
Ah, I didn't realise it was already set for Guix scripts. But yeah,
setting it in other places that read derivations makes sense.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]
prev parent reply other threads:[~2023-11-25 21:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 11:35 [bug#67238] [PATCH] derivations: Avoid readlink syscalls in read-derivation-from-file Christopher Baines
2023-11-24 11:28 ` Ludovic Courtès
2023-11-25 20:58 ` Christopher Baines [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87edgdmtew.fsf@cbaines.net \
--to=mail@cbaines.net \
--cc=67238-close@debbugs.gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.