From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id ML1MG8JiYmXgrAAAG6o9tA:P1 (envelope-from ) for ; Sat, 25 Nov 2023 22:10:26 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id ML1MG8JiYmXgrAAAG6o9tA (envelope-from ) for ; Sat, 25 Nov 2023 22:10:26 +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 D97E665819 for ; Sat, 25 Nov 2023 22:10:25 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=none; 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=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1700946626; 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:resent-to: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; bh=HbtiMZ7ZwNpG/WDH06OKSt68AuaUcJ1msiZ2hS686PQ=; b=FGVGXEYchaCxSfY7h7O2IPEo5q8HVpTy0oepCJiQD7OEGXsdwkKvJKDaZmY8KAr+WcOO45 oEby+hCu0XPp+l9mTIfvSs9TfbXzWhNiv6F88Jjw2fGhJz9ijslHd6fOtY2y1CHXryq/R2 tpoyJspKllQ4y0BBnE1tF1QM/WfNvl8NM3i9F4BnoK6RG7DRkGoJruDHljB1TCEs05qVp3 WsrmQAix0cvgpLVz23ndG8GNICK5bRITfIdqHh+GF/vtmT0XucMewpGL5DKjk2MLNQWU7O rY1/6BOzHlvMV1wn813icc+iOGjcgHO74cmU2RsgfyBMHWjqU0TkC38+u9lOgQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1700946626; a=rsa-sha256; cv=none; b=S0/gP9O5UaKoQC+GW3v42MGZp4zPrY9nSi2iB8LfbBTAy9O4IL5sU+DmtubD5V6d98RHCL knYNxoRy1MOtUvDQJ5X8TxBTxbjuTQZC3eJrph/IlvoFrlPrVNTEj62zw07kE6PUpAzIaL aix8E6BB7RW6Q1iumggIW6U/YXFQp6fy2zW/hHldXOKlH5YfrlyikVxum1f5wnQ2HG0Bj7 B8XK2R5CaO1P0+oo33ggz0RnJf1vll94Db058NcjwqHeSVl4QQ+obk4MfIErwjy/vEwLkv waXtSjmZZ8MdKKAknZAMq9RYsK1ekf6dR5wta+3x4iexGjHja9AXofaOxKO4Nw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6zuZ-000175-Ch; Sat, 25 Nov 2023 16:09:59 -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 1r6zuY-00014F-3G for guix-patches@gnu.org; Sat, 25 Nov 2023 16:09:58 -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 1r6zuX-0007hl-Qp for guix-patches@gnu.org; Sat, 25 Nov 2023 16:09:57 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r6zuc-0003tU-MP for guix-patches@gnu.org; Sat, 25 Nov 2023 16:10:02 -0500 Subject: bug#67238: [PATCH] derivations: Avoid readlink syscalls in read-derivation-from-file. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Sat, 25 Nov 2023 21:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 67238 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 67238-close@debbugs.gnu.org Mail-Followup-To: 67238@debbugs.gnu.org, mail@cbaines.net, mail@cbaines.net Received: via spool by 67238-done@debbugs.gnu.org id=D67238.170094659614943 (code D ref 67238); Sat, 25 Nov 2023 21:10:02 +0000 Received: (at 67238-close) by debbugs.gnu.org; 25 Nov 2023 21:09:56 +0000 Received: from localhost ([127.0.0.1]:40359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6zuV-0003sx-M7 for submit@debbugs.gnu.org; Sat, 25 Nov 2023 16:09:56 -0500 Received: from mira.cbaines.net ([212.71.252.8]:43048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6zuS-0003so-QP for 67238-close@debbugs.gnu.org; Sat, 25 Nov 2023 16:09:53 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 3A23227BBE2; Sat, 25 Nov 2023 21:09:46 +0000 (GMT) Received: from felis (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 0ce3ae0a; Sat, 25 Nov 2023 21:09:45 +0000 (UTC) References: <87wmu775lq.fsf@gnu.org> User-agent: mu4e 1.10.7; emacs 29.1 From: Christopher Baines Date: Sat, 25 Nov 2023 20:58:03 +0000 In-reply-to: <87wmu775lq.fsf@gnu.org> Message-ID: <87edgdmtew.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -8.22 X-Spam-Score: -8.22 X-Migadu-Queue-Id: D97E665819 X-Migadu-Scanner: mx10.migadu.com X-TUID: 8RkbqUvXHbK8 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hi, > > Christopher Baines skribis: > >> strace -c reports over 10,000 readlink syscalls when reading the derivat= ion >> for the hello package. By just setting the %file-port-name-canonicalizat= ion >> fluid, this drops to less than 10. >> >> I'm not sure if this actually improves performance, but doing less is su= rely >> better. >> >> * guix/derivations.scm (read-derivation-from-file): Set >> %file-port-name-canonicalization to 'none when calling call-with-input-f= ile. >> >> 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 = the =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 = 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. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmViYpdfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XfcDhAAhpy+TsA6QPr+tmBAZrLtMocrvkU7DHyi HTfdD9lTL082HX9S3R7O7cAcMADiUOUNJfeIMA7NWfgZDBcksgEYlKKM6vff2HFP uylS4tiwOiURPl70HUm3wlLbPrjXO3yVfpNuSgXjxy8ZFVqFUyhFxT5En96+yZj2 pD4yUxbff2J13kO3H4dvgnDM3lQpuQkxP//Scn20/cJRT85ADniDTUXTilRpP0JZ dG0/1w2fDgvfnsOBltPAyRgRZG0chvWD6amNVx19t0rIdDZ2JYhlMJTFpnSZsi5H InxpJcuFEaiHkwOGGe+XJghqckiJHuKBbiXa8PJ8tN1UbwioFLuotcHz1cEct9VQ Zm3mZi0+aZBfrAml+bOz7gFC/mU3uscvZEOjHw6pj4lPtdxAmOWc+/jG794SD+rf oO/SE7V0yWib/EIZX+saUlWPMeAlooLhKHyG/7nhdHqDExYRajmCZ7x9gf740CV7 PGwFXaHTC8yJllZYvszS+VM19KfL18M+koNruE8Ta0deFDPW12VHAm+s955UDkIA 1zFPpc777g1xzKt+EYwMUzpIegb3JBDDlMukUMiD2v4Wn28mNY2gKv3BdJz5Wld7 qBLRBWwbcC6Z2PuS2HFTvlGXNFP2OD6I/gmoF2nK38A1fbVfkGQTDDrHBvB3Wobv uR3xDz01X2E= =Ct4r -----END PGP SIGNATURE----- --=-=-=--