From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Thu, 28 Jul 2022 07:49:30 +0000 Message-ID: <136c4fe0fcb9ce5181cb@heytings.org> References: <837d46mjen.fsf@gnu.org> <8335esjppt.fsf@gnu.org> <837d43j198.fsf@gnu.org> <83y1wjhkkh.fsf@gnu.org> <83wnc3hkdg.fsf@gnu.org> <49df74e5-e16a-a532-98d1-66c6ff1eb6c6@yandex.ru> <83pmhuft5a.fsf@gnu.org> <05388e8d8836c2e7ef3e@heytings.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="yeQEJQcRXG" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37825"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, Eli Zaretskii , monnier@iro.umontreal.ca To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 28 09:52:10 2022 Return-path: Envelope-to: geb-bug-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 1oGyJV-0009bt-Nw for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Jul 2022 09:52:10 +0200 Original-Received: from localhost ([::1]:46898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGyJT-0007dA-VZ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Jul 2022 03:52:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGyHT-0007bT-BO for bug-gnu-emacs@gnu.org; Thu, 28 Jul 2022 03:50:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGyHS-0000FG-FQ for bug-gnu-emacs@gnu.org; Thu, 28 Jul 2022 03:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oGyHS-0003td-8u for bug-gnu-emacs@gnu.org; Thu, 28 Jul 2022 03:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Jul 2022 07:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.165899457414927 (code B ref 56682); Thu, 28 Jul 2022 07:50:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 28 Jul 2022 07:49:34 +0000 Original-Received: from localhost ([127.0.0.1]:57501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGyH0-0003sg-Dv for submit@debbugs.gnu.org; Thu, 28 Jul 2022 03:49:34 -0400 Original-Received: from heytings.org ([95.142.160.155]:55912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oGyGy-0003sV-2x for 56682@debbugs.gnu.org; Thu, 28 Jul 2022 03:49:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1658994570; bh=pLSQs85WOFng5JVa0xnmhMxupbxMg5mYLoHQYtaK1Yw=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=J2OkllPft4uCY/yPmDMAVS6X1H3GR7zujWZaDtnviCBqAfeVPtABFyGI+KO31lF5S lrmy6v3dqkmYuvnpwjtvjoMAWF297toaGHZD6jSmoSitiIVCfw5KBAmXOFboLRBWHN YRPbU4zD/0ChmmMCagnKm72tdJFol17tBG128KM2w8Osk1LORVFhsLzW0X/+TumTj3 HFyvl1R1DG8nNy+3t0FAJ9IWawq/zt0ADkHTTPL/0fQB4qwu2qWZNyJC9XaS0FpUuF 3tVokEFyiAQ+Og+OsOsNW2W4sAzAiW7EueZXNPdcWebOePXBTDjlEYmToGWgHwYBcF 1r737rhMoLgWQ== In-Reply-To: Content-ID: <136c4fe0fccdbe905446@heytings.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:238077 Archived-At: --yeQEJQcRXG Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-ID: <136c4fe0fc804c073b3a@heytings.org> >> Yes, occasional mis-fontification is expected.=C2=A0 It's a compromise= =20 >> between "no fontification" and "slow fontification". > > I wonder now if the majority of the slowdown was caused by the=20 > redisplay, whereas font-lock (which only has to run once per screenful)= =20 > was actually "fast enough". > Those two statements are not mutually exclusive. The majority of the=20 slowdown was indeed caused by redisplay, but font-lock was not fast=20 enough. Try to open a sufficiently large file (e.g. the dictionary.json=20 one) with the code on master, and type M->. You'll see that Emacs needs=20 about five seconds (on my laptop) to display the end of the buffer. Now=20 compare that with the feature branch, with which the end of the buffer is= =20 displayed instantaneously. That five seconds delay is caused by=20 fontification-functions. > > Could you clarify what you mean by "access ... to the place where ... is= =20 > defined"? "new Downloadify.Container" is highlighted by a regular regexp= =20 > matcher, not some custom elisp code which has to visit the position=20 > where the identifier is defined. > Sorry, I cannot be more precise, I don't have the "downloadify.js" file=20 here. It was just a guess, based on what I saw on the screenshot, that=20 one function called by fontification-functions collects all class=20 definitions and highlights their identifiers elsewhere in the buffer with= =20 a specific face. When the buffer is narrowed, that function may not see=20 the Downloadify.Container definition (which is, I guess, placed near the=20 beginning of the file) anymore. --yeQEJQcRXG--