From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GSIGFT7c5WA/cQEAgWs5BA (envelope-from ) for ; Wed, 07 Jul 2021 18:54:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id yF/XDz7c5WBvRQAA1q6Kng (envelope-from ) for ; Wed, 07 Jul 2021 16:54:22 +0000 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 8060519DF3 for ; Wed, 7 Jul 2021 18:54:21 +0200 (CEST) Received: from localhost ([::1]:54408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1AoW-0007Rg-G2 for larch@yhetil.org; Wed, 07 Jul 2021 12:54:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1AoE-0007Op-SZ for guix-patches@gnu.org; Wed, 07 Jul 2021 12:54:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m1AoE-0007i5-KL for guix-patches@gnu.org; Wed, 07 Jul 2021 12:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m1AoE-0004Jw-Dp for guix-patches@gnu.org; Wed, 07 Jul 2021 12:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49421] [PATCH] profiles: Optimise 'fonts-dir-file'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 07 Jul 2021 16:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49421 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos Cc: 49421@debbugs.gnu.org Received: via spool by 49421-submit@debbugs.gnu.org id=B49421.162567678716539 (code B ref 49421); Wed, 07 Jul 2021 16:54:02 +0000 Received: (at 49421) by debbugs.gnu.org; 7 Jul 2021 16:53:07 +0000 Received: from localhost ([127.0.0.1]:53337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1AnL-0004Ih-5m for submit@debbugs.gnu.org; Wed, 07 Jul 2021 12:53:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1AnG-0004I7-UY for 49421@debbugs.gnu.org; Wed, 07 Jul 2021 12:53:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38624) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1AnA-0007cw-Fi; Wed, 07 Jul 2021 12:52:56 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42804 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1AnA-0002hs-7x; Wed, 07 Jul 2021 12:52:56 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: Date: Wed, 07 Jul 2021 18:52:54 +0200 In-Reply-To: (Maxime Devos's message of "Mon, 05 Jul 2021 21:06:32 +0200") Message-ID: <87a6myoyl5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625676861; 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; bh=I8lPJvx+DRclwI4GqkF40gBNOZP0lJLIOC28XrMOv84=; b=gtA1AGiLVVUzFLgG5PROYACBPxHdjUjg+lD1Ku44SAwyh1/N0JiGSACL4JjmFhJo1f1O3f xsOwrBe321P/42jyrQFjbMtR7SVNR6gPvCbOiu7kpn+7l42a4a084pCEeD2BheQs+0gse2 6Zv3C9Fx1T0w9TEOBJrxtSN1AzIKZtfvjY903Ef2VBkKNmFj/v1gzySfQ2K84s0GQ/tBC/ 9M6HpH2nJeedZTZve4OwrU3qck2Bn6CKkJ+kM2kDxD2+0nXgdb6s6JKrVDxoD815i1hT+R 2XUAyLzQ72k9CchIZhf51fU4B8LFYE8ywAZNh+lkJ/2MpwRD/+fjbMPEZCFB9Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625676861; a=rsa-sha256; cv=none; b=cbW4RrOyoHWH2lOsnJlvMtUcN5eVkL4CGKIgvPdxN9TK+AuPjls0hOM/DL1zAh5HBtSego ZDMN1jxCl5z9lwrDZlSQB3+zIOk4N7lgLIctyzOl/gvq0UXHSDS1nrvKWgv79TMbhHDujk mNwYDPLsgIdZJpX3QcG2oyncFoPVdzPmRNpzOVDgY5d0Uflzy1eVMjYxnoiXWF3MmFxPGl vg/nVjyED+Mg/kFeaE1g2p2IL/V1x+pd2GF5364fBJo8qo0H3eHkZSyQDx0jhy4vMRf7DP S4a1XXfAK+RCD9zclBygpDubxnaZGdrhptlEpBNkixw75BlVCQT/lNtVyIsN9A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.91 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 8060519DF3 X-Spam-Score: -2.91 X-Migadu-Scanner: scn1.migadu.com X-TUID: QOs9Z8tJ49r7 Hi, Maxime Devos skribis: > These two patches should speed up profile generation > by optimising the 'fonts-dir-file' hook. The first patch > is the most important; from the commit message: > > =E2=80=98Only let the build G-exp refer to inputs that might actually > have fonts. That way, if the list of fonts in the manifest > didn't change and the new manifest is built, the font files > will not be rebuilt.=E2=80=99 > > The second patch doesn't bring much. > > To test, you can test whether things like ... > > $ ./pre-inst-env guix environment --ad-hoc --pure lagrange -- lagrange > > still work (lagrange is a graphical application using fonts). > Not sure what a good =E2=80=98benchmark=E2=80=99 would be. > > Unfortunately, this does not help with the "guix package -i" case, > as in that case, the code doesn't have access to all the package objects, > and will have to satisfy itself with the store paths, in which case the > profile code pessimistically assumes the store item has fonts ... > > I suppose this restriction could be lifted if/when the gs-fonts package > is renamed to font-ghostscript or something like that ... Do you know what=E2=80=99s taking time in the =E2=80=98fonts-dir-file=E2=80= =99 hook? (On my x86_64 laptop with SSD, it runs in 4.4s on a cold cache for a profile containing 14 font packages, and in 1.2s on a warm cache.) IIUC, the hook completes almost instantaneously when creating a profile without fonts because (null? fonts-dirs) is true. In other cases, one option to speed things up (and possibly remove the hook=E2=80=99s dependency on mkfontdir) would be to create =E2=80=98fonts.d= ir=E2=80=99 and =E2=80=98fonts.scale=E2=80=99 in a build phase of each font package, *provi= ded* there=E2=80=99s a cheap way to assemble several such files, such as mere concatenation. That way, the profile hook would only need to assemble these files as opposed to traversing all the font files. Given that =E2=80=98fonts.dir=E2=80=99 and =E2=80=98fonts.scale=E2=80=99 ar= e mere text files with one line per font, this approach looks doable. WDYT? > From 4fe1e30e33c01be9fd17cf240732b3351c7b0fa4 Mon Sep 17 00:00:00 2001 > From: Maxime Devos > Date: Mon, 5 Jul 2021 18:55:31 +0200 > Subject: [PATCH 1/2] profiles: Optimise 'fonts-dir-file'. > > Only let the build G-exp refer to inputs that might actually > have fonts. That way, if the list of fonts in the manifest > didn't change and the new manifest is built, the font files > will not be rebuilt. > > * guix/profiles.scm > (fonts-dir-file)[has-fonts?]: New predicate. > (fonts-dir-file)[relevant-inputs]: New variable. > (fonts-dir-file)[build]: Use 'relevant-inputs' instead of > 'manifest-inputs'. > * doc/contributing.texi (Fonts): Note the 'fonts-' naming > convention is technically important now. > * gnu/packages/ghostscript.scm (gs-fonts): Work-around the > package name contravening the convention. To me this approach should be a last resort because it relies on conventions and manual annotations, and it=E2=80=99s easy to forget these a= nd get incorrect results (we could end up having to deal with reports like =E2=80=9CI installed font X, why doesn=E2=80=99t in show up in the font lis= t?=E2=80=9D). > + ;; In the upstream 'guix' channel, font packages should > + ;; be named font-SOMETHING. But if another channel > + ;; names its fonts differently but uses font-build-system, > + ;; accepting that seems friendly. > + (eq? 'font (build-system-name (package-build-system thing))) In general =E2=80=98build-system-name=E2=80=99 shouldn=E2=80=99t be used; t= he name is meant to be a debugging aid. Thanks, Ludo=E2=80=99.