From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oF8aMRj+62ByxwAAgWs5BA (envelope-from ) for ; Mon, 12 Jul 2021 10:32:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id xXbSLBj+62BXBgAAB5/wlQ (envelope-from ) for ; Mon, 12 Jul 2021 08:32:24 +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 2973D7002 for ; Mon, 12 Jul 2021 10:32:20 +0200 (CEST) Received: from localhost ([::1]:52144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2rMR-000457-8C for larch@yhetil.org; Mon, 12 Jul 2021 04:32:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2rMB-00044p-L7 for guix-patches@gnu.org; Mon, 12 Jul 2021 04:32:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2rMA-0001QZ-FF for guix-patches@gnu.org; Mon, 12 Jul 2021 04:32:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m2rMA-00083S-Bn for guix-patches@gnu.org; Mon, 12 Jul 2021 04:32:02 -0400 Subject: bug#49107: [PATCH core-updates] gnu: fontconfig: Use (locally) deterministic caching Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Mon, 12 Jul 2021 08:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 49107 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Sarah Morgensen Cc: 49107-done@debbugs.gnu.org Mail-Followup-To: 49107@debbugs.gnu.org, ludo@gnu.org, iskarian@mgsn.dev Received: via spool by 49107-done@debbugs.gnu.org id=D49107.162607867730908 (code D ref 49107); Mon, 12 Jul 2021 08:32:02 +0000 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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-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=1626078740; 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-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=IZct/sRspIewjLx6PdbfXyT8foqZS3+/NhVQ5rC72p0=; b=uTRbgS7ujAB0RQWaouSIjeMLzHl1HPvQyJ/NShVa0EgQrLSC2j7OW9n/Fulu+rw9qmzZb4 zFrguSJuI0DCrAFitWxH4UFIcvyP8BuT3LyTGQDK6TTusdyv/G8ZloH4yligMQ12n1hwdi briCgEtGoZYJ5jZ3NLO1gIEGFWL33P3p6GEHncPnGEjUFi9Rg2NTugHlpPSbwdOeIwkwYi 0FxvyQs+JyMxWi2xlc+WZp5VzouiuMeTBsmsMaO3xE4OsjNUG19iIWC4UhK64ovk2Ml0jd 5N9aX5y9SreajKdnNDTA3YjbsNLIvMT8PigRHoO7YSHVNVLK26qAa+ym7OuKFA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626078740; a=rsa-sha256; cv=none; b=DOk3tA7RZsx22Z7llp7hc8g7lAmcc4tQxCd5eWTzLW62PdOezl+58se5prNerYZQLYI9jJ PvcyC0spwp3ZrmJqqP2J1vR8A7hYOtS+isxHMybb4hdAh/C8Z++ZY3K57WhVAjQM/xzl1G SkJ1a9ZEP/zcuYNSrJK3x3C0EOEu3DIBD6tge/YEEPuLApMsMPgOgmKk4JsKbN16HOCWeI rofgTaTDZK9nwXe4VrXhjvt7pM8v/kJhesyLOhphZYY7OHnT23vhXu7biVZL3LHJY/2pQ/ 3YThlKULMKD9fUJ1oAeHRUoIX4d2NWA8nXzD48fUXV4I3vbUuPBPoksNQ4XV0g== ARC-Authentication-Results: i=1; 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-Spam-Score: -1.40 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: 2973D7002 X-Spam-Score: -1.40 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6L8lvHEmlv5s 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.