From unknown Sat Jun 21 10:38:11 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#49107 <49107@debbugs.gnu.org> To: bug#49107 <49107@debbugs.gnu.org> Subject: Status: [PATCH core-updates] gnu: fontconfig: Use (locally) deterministic caching Reply-To: bug#49107 <49107@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:38:11 +0000 retitle 49107 [PATCH core-updates] gnu: fontconfig: Use (locally) determini= stic caching reassign 49107 guix-patches submitter 49107 Sarah Morgensen severity 49107 normal tag 49107 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 18 20:52:26 2021 Received: (at submit) by debbugs.gnu.org; 19 Jun 2021 00:52:26 +0000 Received: from localhost ([127.0.0.1]:58364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luPDg-0001oS-Ia for submit@debbugs.gnu.org; Fri, 18 Jun 2021 20:52:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:56192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luPDf-0001oL-2K for submit@debbugs.gnu.org; Fri, 18 Jun 2021 20:52:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luPDe-0001E1-P1 for guix-patches@gnu.org; Fri, 18 Jun 2021 20:52:18 -0400 Received: from out1.migadu.com ([2001:41d0:2:863f::]:59794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luPDb-0005ov-0M for guix-patches@gnu.org; Fri, 18 Jun 2021 20:52:18 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1624063929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2UECakbBe4mzsqpu4+Bh2chYXQwVBUjomBYA3s//rwU=; b=Ylt0XavSRij3+OGONRkFKZAg9OayLwwvIPFsmEp57gdjPt0SuSiUk3Og+R1S/uixs+y+80 cu9RV9WpXXMvDCSUr7j0HHhIPGQ1Oq45Z6xJc9489Zu+O/5Vb+R4MdHTkh+hSM0oyiHcPC vN26EfRgyltrKGj6q1weCbkTsAILeHQ= From: Sarah Morgensen To: guix-patches@gnu.org Subject: [PATCH core-updates] gnu: fontconfig: Use (locally) deterministic caching Date: Fri, 18 Jun 2021 17:52:05 -0700 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev Received-SPF: pass client-ip=2001:41d0:2:863f::; envelope-from=iskarian@mgsn.dev; helo=out1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Make fontconfig use directory contents rather than modification time to determine cache validity (by pretending that mtime is broken). * gnu/packages/patches/fontconfig-cache-ignore-mtime.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/fontutils.scm (fontconfig)[source]: Use it. [arguments]: Unset SOURCE_DATE_EPOCH for tests. --- gnu/local.mk | 1 + gnu/packages/fontutils.scm | 7 ++++++- .../patches/fontconfig-cache-ignore-mtime.patch | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/fontconfig-cache-ignore-mtime.patch Hello Guix, This patch attempts to make fontconfig's caching work seamlessly on Guix, instead of requiring users to manually run `fc-cache -f` after installing or removing fonts. This addresses . Fontconfig usually uses a directory's mtime as its checksum. However, when fontconfig detects a "broken mtime" filesystem, it will generate a directory checksum from the directory listing contents. This is slightly slower, as it has to stat all the files in all font directories. Unconditionally enabling this mode should get us more regular behavior. I am not confident this method is fully deterministic; particular filesystem capabilities may still be an implicit imput in the checksums. This should only matter when distributing pre-generated caches. Fontconfig does honor SOURCE_DATE_EPOCH, but without a reliable mtime, fontconfig has no way of knowing when to update such a cache. SOURCE_DATE_EPOCH is now disabled for the tests because they assume working cache invalidation. I have tested this patch on x86-64. diff --git a/gnu/local.mk b/gnu/local.mk index c57e587e84..1d26c9e7c7 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1012,6 +1012,7 @@ dist_patch_DATA = \ %D%/packages/patches/fifo-map-remove-catch.hpp.patch \ %D%/packages/patches/findutils-localstatedir.patch \ %D%/packages/patches/flann-cmake-3.11.patch \ + %D%/packages/patches/fontconfig-cache-ignore-mtime.patch \ %D%/packages/patches/foobillard++-pkg-config.patch \ %D%/packages/patches/foomatic-filters-CVE-2015-8327.patch \ %D%/packages/patches/foomatic-filters-CVE-2015-8560.patch \ diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm index dbce5beba8..0ee51a792e 100644 --- a/gnu/packages/fontutils.scm +++ b/gnu/packages/fontutils.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2020 Nicolas Goaziou ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2020, 2021 Nicolas Goaziou +;;; Copyright © 2021 Sarah Morgensen ;;; ;;; This file is part of GNU Guix. ;;; @@ -331,7 +332,8 @@ Font Format (WOFF).") "https://www.freedesktop.org/software/" "fontconfig/release/fontconfig-" version ".tar.xz")) (sha256 (base32 - "1850q4k80yxma5g3yxkvyv8i5a3xqzswwml8gjy3jmywx8qqd5pa")))) + "1850q4k80yxma5g3yxkvyv8i5a3xqzswwml8gjy3jmywx8qqd5pa")) + (patches (search-patches "fontconfig-cache-ignore-mtime.patch")))) (build-system gnu-build-system) ;; In Requires or Requires.private of fontconfig.pc. (propagated-inputs `(("expat" ,expat) @@ -362,6 +364,9 @@ Font Format (WOFF).") (modify-phases %standard-phases (add-before 'check 'skip-problematic-tests (lambda _ + ;; SOURCE_DATE_EPOCH doesn't make sense when ignoring mtime + (unsetenv "SOURCE_DATE_EPOCH") + (substitute* "test/run-test.sh" ;; The crbug1004254 test attempts to fetch fonts from the ;; network. diff --git a/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch b/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch new file mode 100644 index 0000000000..b6e942ee10 --- /dev/null +++ b/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch @@ -0,0 +1,15 @@ +Pretend that stat's mtime is broken, so that the fontconfig cache does not +depend upon modification time to determine if a cache is stale. + +diff --git a/src/fcstat.c b/src/fcstat.c +index 5a2bd7c..d603a96 100644 +--- a/src/fcstat.c ++++ b/src/fcstat.c +@@ -431,6 +431,7 @@ FcIsFsMmapSafe (int fd) + FcBool + FcIsFsMtimeBroken (const FcChar8 *dir) + { ++ return FcTrue; + int fd = FcOpen ((const char *) dir, O_RDONLY); + + if (fd != -1) base-commit: bcdc13454c4afab37b650d4bbfa95e539060619f -- 2.31.1 From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 07 17:16:23 2021 Received: (at 49107) by debbugs.gnu.org; 7 Jul 2021 21:16:23 +0000 Received: from localhost ([127.0.0.1]:53651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1Eu7-0004tV-DS for submit@debbugs.gnu.org; Wed, 07 Jul 2021 17:16:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1Eu2-0004tG-Sg for 49107@debbugs.gnu.org; Wed, 07 Jul 2021 17:16:21 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46186) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1Etv-0004W0-No; Wed, 07 Jul 2021 17:16:11 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42806 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1Etv-0008Q4-GU; Wed, 07 Jul 2021 17:16:11 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Sarah Morgensen Subject: Re: bug#49107: [PATCH core-updates] gnu: fontconfig: Use (locally) deterministic caching References: Date: Wed, 07 Jul 2021 23:16:09 +0200 In-Reply-To: (Sarah Morgensen's message of "Fri, 18 Jun 2021 17:52:05 -0700") Message-ID: <87sg0pomee.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49107 Cc: 49107@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Sarah Morgensen skribis: > Make fontconfig use directory contents rather than modification time to > determine cache validity (by pretending that mtime is broken). > > * gnu/packages/patches/fontconfig-cache-ignore-mtime.patch: New file. > * gnu/local.mk (dist_patch_DATA): Register it. > * gnu/packages/fontutils.scm (fontconfig)[source]: Use it. > [arguments]: Unset SOURCE_DATE_EPOCH for tests. > --- > gnu/local.mk | 1 + > gnu/packages/fontutils.scm | 7 ++++++- > .../patches/fontconfig-cache-ignore-mtime.patch | 15 +++++++++++++++ > 3 files changed, 22 insertions(+), 1 deletion(-) > create mode 100644 gnu/packages/patches/fontconfig-cache-ignore-mtime.pa= tch > > Hello Guix, > > This patch attempts to make fontconfig's caching work seamlessly on Guix, > instead of requiring users to manually run `fc-cache -f` after installing= or > removing fonts. This addresses . > > Fontconfig usually uses a directory's mtime as its checksum. However, when > fontconfig detects a "broken mtime" filesystem, it will generate a direct= ory > checksum from the directory listing contents. This is slightly slower, as= it has > to stat all the files in all font directories. Unconditionally enabling t= his > mode should get us more regular behavior. Nice, sounds like an improvement! Does Fontconfig stats all these files every time an application starts? Did you compare =E2=80=98strace -c some app=E2=80=99 with and without this = change, to get an idea of what it costs? > I am not confident this method is fully deterministic; particular filesys= tem > capabilities may still be an implicit imput in the checksums. This should= only > matter when distributing pre-generated caches. > > Fontconfig does honor SOURCE_DATE_EPOCH, but without a reliable mtime, > fontconfig has no way of knowing when to update such a cache. SOURCE_DATE= _EPOCH > is now disabled for the tests because they assume working cache invalidat= ion. So tests fail is we leave SOURCE_DATE_EPOCH, right? Thanks for addressing this longstanding issue! (And apologies for the delay=E2=80=A6 Now=E2=80=99s a good time to get semi-high-level changes li= ke this one in =E2=80=98core-updates=E2=80=99.) Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 07 21:17:37 2021 Received: (at 49107) by debbugs.gnu.org; 8 Jul 2021 01:17:37 +0000 Received: from localhost ([127.0.0.1]:53838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1IfZ-0006tg-6l for submit@debbugs.gnu.org; Wed, 07 Jul 2021 21:17:37 -0400 Received: from out2.migadu.com ([188.165.223.204]:60691) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m1IfW-0006r6-VD for 49107@debbugs.gnu.org; Wed, 07 Jul 2021 21:17:36 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1625707053; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=snAVT6g0nZXuzgjQLbY+YAdlJFIUIVPiQoQGD04OPCs=; b=UvKx1s2UCOR50WPTb4O0YXz4v6gPnDfgptAB2VNkrILzB5p6jSUFNa5AW0ba1yElqatSYI iEXLeWxHVvh7l60a9JVpcMNB8ZZH9Oeh/U3yECVE2L/w428B1WuBJyWmomSeVBADFA+UfP hGpepdZfuIEJ2kFjmJpdKGcIHCYafOg= From: Sarah Morgensen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#49107: [PATCH core-updates] gnu: fontconfig: Use (locally) deterministic caching References: <87sg0pomee.fsf@gnu.org> Date: Wed, 07 Jul 2021 18:17:30 -0700 In-Reply-To: <87sg0pomee.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Wed, 07 Jul 2021 23:16:09 +0200") Message-ID: <86eec9k3it.fsf_-_@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 49107 Cc: 49107@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Thanks for taking a look at this. Ludovic Court=C3=A8s writes: >> Fontconfig usually uses a directory's mtime as its checksum. However, wh= en >> fontconfig detects a "broken mtime" filesystem, it will generate a direc= tory >> checksum from the directory listing contents. This is slightly slower, a= s it has >> to stat all the files in all font directories. Unconditionally enabling = this >> mode should get us more regular behavior. > > Nice, sounds like an improvement! > > Does Fontconfig stats all these files every time an application starts? > Did you compare =E2=80=98strace -c some app=E2=80=99 with and without thi= s change, to > get an idea of what it costs? I *believe* it does so whenever an application calls FcFontList or such, which is usually on startup. I haven't done tracing with an application that actually uses FcFontList, but I just now ran a naive test, along the lines of: $ fc-cache -rf $ strace -c fc-list The old fc-list: --8<---------------cut here---------------start------------->8--- % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 28.50 0.000226 0 228 142 openat 22.19 0.000176 1 136 26 access 11.10 0.000088 0 133 70 stat 5.93 0.000047 0 86 close 5.55 0.000044 2 22 fstatfs 5.30 0.000042 0 54 37 readlink 4.54 0.000036 4 8 munmap 3.78 0.000030 0 70 mmap 2.65 0.000021 1 20 write 2.52 0.000020 0 104 read 2.52 0.000020 0 40 fstat 1.89 0.000015 1 8 fadvise64 1.77 0.000014 1 10 getpid 0.88 0.000007 0 10 brk 0.63 0.000005 0 35 getrandom 0.25 0.000002 2 1 1 ioctl 0.00 0.000000 0 15 mprotect 0.00 0.000000 0 2 rt_sigaction 0.00 0.000000 0 1 rt_sigprocmask 0.00 0.000000 0 1 execve 0.00 0.000000 0 1 arch_prctl 0.00 0.000000 0 1 futex 0.00 0.000000 0 4 getdents64 0.00 0.000000 0 1 set_tid_address 0.00 0.000000 0 1 set_robust_list 0.00 0.000000 0 1 prlimit64 ------ ----------- ----------- --------- --------- ---------------- 100.00 0.000793 0 993 276 total --8<---------------cut here---------------end--------------->8--- And the patched fc-list: --8<---------------cut here---------------start------------->8--- % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 17.19 0.000125 0 126 11 access 14.44 0.000105 0 126 52 openat 12.24 0.000089 1 55 mmap 10.32 0.000075 0 99 read 8.67 0.000063 4 15 mprotect 8.25 0.000060 0 94 6 newfstatat 5.50 0.000040 0 74 close 5.23 0.000038 0 58 40 readlink 4.68 0.000034 34 1 set_tid_address 3.30 0.000024 0 38 getrandom 3.16 0.000023 1 13 pread64 1.65 0.000012 0 26 getdents64 1.51 0.000011 1 9 brk 1.10 0.000008 4 2 rt_sigaction 0.83 0.000006 0 9 munmap 0.55 0.000004 4 1 rt_sigprocmask 0.55 0.000004 4 1 prlimit64 0.41 0.000003 3 1 arch_prctl 0.41 0.000003 3 1 set_robust_list 0.00 0.000000 0 20 write 0.00 0.000000 0 1 1 ioctl 0.00 0.000000 0 1 execve 0.00 0.000000 0 1 sysinfo 0.00 0.000000 0 11 fstatfs 0.00 0.000000 0 8 fadvise64 ------ ----------- ----------- --------- --------- ---------------- 100.00 0.000727 0 791 110 total --8<---------------cut here---------------end--------------->8--- Now that is unexpected! There are actually less stats and opens. I'm stumped! My profile has about 20 font packages (about 450 actual files) installed. For reference, for both versions, `fc-cache -rf` yields about 3700 stats; and `fc-cache` yeilds about 300... I suppose I should be more careful about speaking from theory! > >> I am not confident this method is fully deterministic; particular filesy= stem >> capabilities may still be an implicit imput in the checksums. This shoul= d only >> matter when distributing pre-generated caches. >> >> Fontconfig does honor SOURCE_DATE_EPOCH, but without a reliable mtime, >> fontconfig has no way of knowing when to update such a cache. SOURCE_DAT= E_EPOCH >> is now disabled for the tests because they assume working cache invalida= tion. > > So tests fail is we leave SOURCE_DATE_EPOCH, right? Correct. > Thanks for addressing this longstanding issue! (And apologies for the > delay=E2=80=A6 Now=E2=80=99s a good time to get semi-high-level changes = like this one > in =E2=80=98core-updates=E2=80=99.) I still wish we could address it "properly" by generating a cache at profile generation time... but it looks like fontconfig embeds the full paths of fonts in the cache (including username, since fonts are under ~/.guix-profile), so I doubt such a cache would work. I plan to try it eventually anyway (or perhaps someone else will), but in the meantime, this looks like the 80% solution. -- Sarah From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 12 04:31:17 2021 Received: (at 49107-done) by debbugs.gnu.org; 12 Jul 2021 08:31:17 +0000 Received: from localhost ([127.0.0.1]:36518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2rLR-00082R-AU for submit@debbugs.gnu.org; Mon, 12 Jul 2021 04:31:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2rLP-00082F-M5 for 49107-done@debbugs.gnu.org; Mon, 12 Jul 2021 04:31:16 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44152) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2rLK-0000kf-7b; Mon, 12 Jul 2021 04:31:10 -0400 Received: from [2a01:e34:ec7d:930:eb2e:c349:7011:a75] (port=42662 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2rLE-0002sK-OP; Mon, 12 Jul 2021 04:31:08 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Sarah Morgensen Subject: Re: bug#49107: [PATCH core-updates] gnu: fontconfig: Use (locally) deterministic caching References: <87sg0pomee.fsf@gnu.org> <86eec9k3it.fsf_-_@mgsn.dev> Date: Mon, 12 Jul 2021 10:30:56 +0200 In-Reply-To: <86eec9k3it.fsf_-_@mgsn.dev> (Sarah Morgensen's message of "Wed, 07 Jul 2021 18:17:30 -0700") Message-ID: <87o8b87x33.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49107-done Cc: 49107-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Sarah Morgensen skribis: > Ludovic Court=C3=A8s writes: [...] >> Does Fontconfig stats all these files every time an application starts? >> Did you compare =E2=80=98strace -c some app=E2=80=99 with and without th= is change, to >> get an idea of what it costs? > > I *believe* it does so whenever an application calls FcFontList or such, > which is usually on startup. I haven't done tracing with an application > that actually uses FcFontList, but I just now ran a naive test, along > the lines of: > > $ fc-cache -rf > $ strace -c fc-list > > The old fc-list: > > % time seconds usecs/call calls errors syscall > ------ ----------- ----------- --------- --------- ---------------- > 28.50 0.000226 0 228 142 openat > 22.19 0.000176 1 136 26 access > 11.10 0.000088 0 133 70 stat > 5.93 0.000047 0 86 close > 5.55 0.000044 2 22 fstatfs > 5.30 0.000042 0 54 37 readlink > 4.54 0.000036 4 8 munmap > 3.78 0.000030 0 70 mmap > 2.65 0.000021 1 20 write > 2.52 0.000020 0 104 read > 2.52 0.000020 0 40 fstat > 1.89 0.000015 1 8 fadvise64 > 1.77 0.000014 1 10 getpid > 0.88 0.000007 0 10 brk > 0.63 0.000005 0 35 getrandom > 0.25 0.000002 2 1 1 ioctl > 0.00 0.000000 0 15 mprotect > 0.00 0.000000 0 2 rt_sigaction > 0.00 0.000000 0 1 rt_sigprocmask > 0.00 0.000000 0 1 execve > 0.00 0.000000 0 1 arch_prctl > 0.00 0.000000 0 1 futex > 0.00 0.000000 0 4 getdents64 > 0.00 0.000000 0 1 set_tid_address > 0.00 0.000000 0 1 set_robust_list > 0.00 0.000000 0 1 prlimit64 > ------ ----------- ----------- --------- --------- ---------------- > 100.00 0.000793 0 993 276 total > > > And the patched fc-list: > > % time seconds usecs/call calls errors syscall > ------ ----------- ----------- --------- --------- ---------------- > 17.19 0.000125 0 126 11 access > 14.44 0.000105 0 126 52 openat > 12.24 0.000089 1 55 mmap > 10.32 0.000075 0 99 read > 8.67 0.000063 4 15 mprotect > 8.25 0.000060 0 94 6 newfstatat > 5.50 0.000040 0 74 close > 5.23 0.000038 0 58 40 readlink > 4.68 0.000034 34 1 set_tid_address > 3.30 0.000024 0 38 getrandom > 3.16 0.000023 1 13 pread64 > 1.65 0.000012 0 26 getdents64 > 1.51 0.000011 1 9 brk > 1.10 0.000008 4 2 rt_sigaction > 0.83 0.000006 0 9 munmap > 0.55 0.000004 4 1 rt_sigprocmask > 0.55 0.000004 4 1 prlimit64 > 0.41 0.000003 3 1 arch_prctl > 0.41 0.000003 3 1 set_robust_list > 0.00 0.000000 0 20 write > 0.00 0.000000 0 1 1 ioctl > 0.00 0.000000 0 1 execve > 0.00 0.000000 0 1 sysinfo > 0.00 0.000000 0 11 fstatfs > 0.00 0.000000 0 8 fadvise64 > ------ ----------- ----------- --------- --------- ---------------- > 100.00 0.000727 0 791 110 total > > Now that is unexpected! There are actually less stats and opens. I'm > stumped! My profile has about 20 font packages (about 450 actual files) > installed. For reference, for both versions, `fc-cache -rf` yields about > 3700 stats; and `fc-cache` yeilds about 300... Well, even better. :-) I went ahead and applied the patch. =E2=80=98fontconfig-minimal=E2=80=99 b= uilds fine; =E2=80=98fonconfig=E2=80=99 (with documentation) fails to build its PDF doc= umentation, but that=E2=80=99s not related to this change. > I still wish we could address it "properly" by generating a cache at > profile generation time... but it looks like fontconfig embeds the full > paths of fonts in the cache (including username, since fonts are under > ~/.guix-profile), so I doubt such a cache would work. I plan to try it > eventually anyway (or perhaps someone else will), but in the meantime, > this looks like the 80% solution. Yeah. It could be that each font package could contain its own cache, and the profile hook would just assemble all these caches (provided the file format makes it possible without too much of a headache). Thanks! Ludo=E2=80=99. From unknown Sat Jun 21 10:38:11 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 09 Aug 2021 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator