From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id MK7+HRWJYGWgcQEAG6o9tA:P1 (envelope-from ) for ; Fri, 24 Nov 2023 12:29:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MK7+HRWJYGWgcQEAG6o9tA (envelope-from ) for ; Fri, 24 Nov 2023 12:29:25 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3BDFD104C2 for ; Fri, 24 Nov 2023 12:29:25 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=kV3At4pV; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1700825365; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=lV+wie1Hz+eT9Os7+Kd4UTIOwcQWhnvAmQfP1rzEENE=; b=MH1LiKdnxbWheOCXU32SPyuTtEtVWyk/K1/b9FUPZTobGk0SGmOAuKJQ0mpFQxDVZA4nM/ i+xRA+AV4B+XS8zOUk+1X3ywRGm16yQIA+QyVTJ8AV6p3/4ucLOQBBJ2p7XnoouwV7Uxr4 Dr0tFn4x/nJlAWtuXeZD9bBIQHGmqaJ90kOwkcUXUS+yDHnMFe7A28DWvjc7fgfuOg35S7 YsAHdWj/gb4EbeHmyJOIoq0pjakRcfXdC6E72a1uvlK8DE57yrNIMWn4rZquL0EJiHkbIj JVEcLGBnLXvh/5CzIIo80jBejAN8LbtmrmW5H1ZccpUfa1lbqOOklw3+aki3iA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=kV3At4pV; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1700825365; a=rsa-sha256; cv=none; b=PQKTFMzfukjMY9z90Pj3iHCtCUK0rCGzNZeajgafOyZEjSywuJrqqDTiVncxfve+y6tAWg dUz7zlCkAo7UWPQ3EHQKrH/CQFmZg2Uj3oJcb8LOrzuP6uHlg2NgXb1ZcO+pn/fMGgrv+t LRsFW0jB1yRgUrew5ZJOYnQNM5hIRasE/51p/YP3NjXW+aYQ7vJZa10QI62CRZw6nKjM5p cUIuIumsjKnQ1LHuxp8160ed0bvRXOG/pt3eDiIuYo+3ZGTgrJpPhIla90NRXb/r1OoYgR tN9Tt0vsXLfeHvS/MjigC0k8KbWgkYu/+pz82YslqdVKYfhqcox3Na/oXAPS/A== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6UMw-0001O2-3J; Fri, 24 Nov 2023 06:29:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6UMk-0001Ei-LQ for guix-patches@gnu.org; Fri, 24 Nov 2023 06:29:00 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r6UMk-0005rM-Cd for guix-patches@gnu.org; Fri, 24 Nov 2023 06:28:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r6UMo-000731-Fk for guix-patches@gnu.org; Fri, 24 Nov 2023 06:29:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67238] [PATCH] derivations: Avoid readlink syscalls in read-derivation-from-file. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Nov 2023 11:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67238 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: Josselin Poiret , Tobias Geerinckx-Rice , Simon Tournier , Mathieu Othacehe , 67238@debbugs.gnu.org, Ricardo Wurmus , Christopher Baines Received: via spool by 67238-submit@debbugs.gnu.org id=B67238.170082533427076 (code B ref 67238); Fri, 24 Nov 2023 11:29:02 +0000 Received: (at 67238) by debbugs.gnu.org; 24 Nov 2023 11:28:54 +0000 Received: from localhost ([127.0.0.1]:35740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6UMf-00072e-RC for submit@debbugs.gnu.org; Fri, 24 Nov 2023 06:28:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6UMc-00072K-Tk for 67238@debbugs.gnu.org; Fri, 24 Nov 2023 06:28:51 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6UMQ-0005Za-IX; Fri, 24 Nov 2023 06:28:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=lV+wie1Hz+eT9Os7+Kd4UTIOwcQWhnvAmQfP1rzEENE=; b=kV3At4pVBu8or4xVrbNp Yq6fpnqBnfB5KFyMFXym2oOmlkJvKUYbASzm0wMTcMKHdzTLtbLrJG3u1JoNFDhltWX1ICEUY4fz3 WARQPe6XiFsTqNCxrjXiPg5/NQpx/s12gcDNn5WJq4PmqTKJz+t7ocknclgfPCr/W6mt4re1H9qbN MuI+5Ax0lRfL+0tEyBgxEA1m/i9Vq0ap0x39xXKISMhXjPgjxaS8R0orAhjcd+A90oCI+nXo7WQDn 8Ygz2mu+jYgKNOhRLb9zqi+J2jZjhCWIvL6X5JY7MMNVQtDHA1eO/WgQBx2XOQbjyU0YNIg6OVDWv EFdwm9HiAPC3Zg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: (Christopher Baines's message of "Fri, 17 Nov 2023 11:35:34 +0000") References: Date: Fri, 24 Nov 2023 12:28:33 +0100 Message-ID: <87wmu775lq.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -5.32 X-Spam-Score: -5.32 X-Migadu-Queue-Id: 3BDFD104C2 X-Migadu-Scanner: mx13.migadu.com X-TUID: AU9z9Iqej4Po Hi, Christopher Baines skribis: > strace -c reports over 10,000 readlink syscalls when reading the derivati= on > for the hello package. By just setting the %file-port-name-canonicalizati= on > fluid, this drops to less than 10. > > I'm not sure if this actually improves performance, but doing less is sur= ely > better. > > * guix/derivations.scm (read-derivation-from-file): Set > %file-port-name-canonicalization to 'none when calling call-with-input-fi= le. > > 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 =E2=80=98run-guix=E2=80=99 in (guix ui), for all th= e =E2=80=98guix=E2=80=99 commands (so this patch would be a slight performance regression for Guix itself). I=E2=80=99d suggest setting this fluid globally in applications that use Gu= ix (the Build Coordinator, etc.), as is done in Guix itself. WDYT? Ludo=E2=80=99.