all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Christopher Baines <mail@cbaines.net>
Cc: Josselin Poiret <dev@jpoiret.xyz>,
	Tobias Geerinckx-Rice <me@tobias.gr>,
	Simon Tournier <zimon.toutoune@gmail.com>,
	Mathieu Othacehe <othacehe@gnu.org>,
	67238@debbugs.gnu.org, Ricardo Wurmus <rekado@elephly.net>,
	Christopher Baines <guix@cbaines.net>
Subject: [bug#67238] [PATCH] derivations: Avoid readlink syscalls in read-derivation-from-file.
Date: Fri, 24 Nov 2023 12:28:33 +0100	[thread overview]
Message-ID: <87wmu775lq.fsf@gnu.org> (raw)
In-Reply-To: <a0061470c9d839f1503fea238c5e3b3ed92fd660.1700220934.git.mail@cbaines.net> (Christopher Baines's message of "Fri, 17 Nov 2023 11:35:34 +0000")

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?

Ludo’.




  reply	other threads:[~2023-11-24 11:29 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 [this message]
2023-11-25 20:58   ` bug#67238: " Christopher Baines

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=87wmu775lq.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=67238@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=guix@cbaines.net \
    --cc=mail@cbaines.net \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    --cc=zimon.toutoune@gmail.com \
    /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.