From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Is font fallback slow over X11/ssh? Date: Thu, 28 May 2020 19:11:12 +0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="28686"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 28 14:11:59 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jeHOB-0007La-20 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 28 May 2020 14:11:59 +0200 Original-Received: from localhost ([::1]:47266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jeHO9-0006dD-Aa for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 28 May 2020 08:11:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeHNg-0006bD-8Z for help-gnu-emacs@gnu.org; Thu, 28 May 2020 08:11:28 -0400 Original-Received: from mail-vk1-xa33.google.com ([2607:f8b0:4864:20::a33]:34935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jeHNe-0006pI-Kf for help-gnu-emacs@gnu.org; Thu, 28 May 2020 08:11:27 -0400 Original-Received: by mail-vk1-xa33.google.com with SMTP id m23so337459vko.2 for ; Thu, 28 May 2020 05:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=mzeWBZuDKkDQKqOZj/te3klbqCKou37v2SQ8WjYVP28=; b=EGxzg4BxgoTsk7+e/iJmMQ3CMI/wjrK7rXHwdU6GZs57tQFJ5cAvDCQi/ggPv8KGE1 ySH+1cePOLe01X7qCtwgzotIhuQJxR+neKwtUCox1tVRM3hfDHwrD3LIbmTLWBdEd3Dt yA3JijLRNWUL+X4eBT8gTPwsYFtkUYZhv9UqEfE4r4XcSZDGR1Uxtmf/r/URtVUqsCLg T8sM88fAaAaRGSXi13y/mrQbPpO63z2tp68kW70JXKBMr+B3/fdQUplV8jUFzgleXv9O q+lnuKHXRbSffIDtUogCDkOfLFUH9xVgW33aA5xLjZyErKSh5HYcw98AK5Io3GCuBWfG 6DDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=mzeWBZuDKkDQKqOZj/te3klbqCKou37v2SQ8WjYVP28=; b=EPeTn2HHIZXRTqxv35k458LlquWTRF3r8Xr7oMJr4p7/n5lDxZDFi9Zkkmz3Ow8lLp DhAX+878kNfrwfbvrCCjaS05nYUOR2I1z0eGEhTnYQXO9mqiXSwqab8KuuuoaLNWwLj/ SQDKX/XrIh8r0H+9ySHzLgh2Ds9aaL9kMVHFf+yoE9nhE8dEfeJ+wRU9NbgmBit0qRJI GR8nTSSoswda62AqjzKicaQz2N0L3xvbE6xn0hLzKm9Uhqs5G/l6+T7QAS7yP2Rx+clf TrLYaYPaNgWOnpYaaa0wvfdvcyfhLTulwmdCKY4UvhHrngNIPhRc0+djK7sa88ZaAWax FGWQ== X-Gm-Message-State: AOAM533QV0QdwhUNT0qy2CG/OGdGdAEsGfutfKWw6PQGwLW0HAq1fWNx o6lO0O0YVxlBJhKzCJAjO9PHdv07O2K4VteRgl/0qrQNl3k= X-Google-Smtp-Source: ABdhPJxE2eWC9O2a+rHT+kXc0YJT17lnYvYEyMrIcg00rBPMQjxoOzqoGzjARPsWDMXigcD3LwDyCZa1hyul1HG3kLc= X-Received: by 2002:a05:6122:4e:: with SMTP id q14mr1756142vkn.57.1590667884364; Thu, 28 May 2020 05:11:24 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::a33; envelope-from=yurivkhan@gmail.com; helo=mail-vk1-xa33.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:123147 Archived-At: Hello, yesterday/today I got to investigate an issue that I perceived as =E2=80=9Cslow Emacs startup=E2=80=9D. I=E2=80=99d like to share my findings= . The setup goes like this: * Home machine: Ubuntu 20.04, X.org, =E2=80=98fc-list | wc -l=E2=80=99 says= 2698. * Office machine: Ubuntu 18.04, X.org, Emacs 26.3/GTK+3, some customizations involving minor mode lighter changes replacing words with Unicode characters. I run Emacs on the office machine over ssh with X11 forwarding, so the GUI is displayed on my home machine. Every time I started Emacs this way, it took several minutes to start up and become usable. I had thought it was due to the complexity of my init.el. However, when I added a (message "%s" (emacs-init-time)) to the end of it, I found out that it gets echoed fairly early, in about 30s from the process start. Bisecting the set of files loaded from my init.el led me to the one that enables undo-tree. When I disabled its loading, Emacs became responsive in about 30s. When I enabled it again, it took ~3min to start. I then did a =E2=80=98profile-start=E2=80=99 and loaded it manually. =E2=80= =98profile-report=E2=80=99 said=E2=80=A6 most of the time was spent in redisplay. Now, as I said, I change some modes=E2=80=99 lighters to symbols. In particular, for undo-tree, I use =E2=AE=8C=F0=9F=8C=B2 (U+2B8C Anticlockwis= e triangle-headed right u-shaped arrow, U+1F332 Evergreen tree). I imagine what happens is this: * Emacs starts up. * undo-tree mode activates. * Emacs finishes starting up and is ready to paint the screen. * Emacs: Okay, let=E2=80=99s draw that lighter. Hey X, does the Cousine fon= t have =E2=AE=8C and =F0=9F=8C=B2 glyphs? * X: No. * Now Emacs starts enumerating the fonts, looking for one that does have at least one of those glyphs. If I=E2=80=99m fortunate, it finds one after a few tries. If not, it enumerates hundreds of fonts. I can imagine each attempt taking a network round trip, and possibly some data transfer. I believe I managed to fix the issue by moving the =E2=80=98unicode-fonts= =E2=80=99 package configuration higher in the init sequence and telling it about several Unicode blocks that I had neglected earlier. Now, Emacs finds the necessary fonts much faster. Is my understanding of the font fallback mechanics correct? Could I customize it to not ever do that? If my default font does not have a glyph for a code point, and none of the fonts in the fontset have glyphs for that code point, don=E2=80=99t go scanning all my fonts, ju= st display a tofu and be done with it.