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: Sat, 13 Aug 2022 17:43:45 +0000 Message-ID: <66bbbb95983475c5f3b0@heytings.org> References: <834jyq29o1.fsf@gnu.org> <92da07bd028e3ede61a6@heytings.org> <47894c57-dd8b-5778-240a-3fa6540e4d37@yandex.ru> <92da07bd02941d5537e9@heytings.org> <5308e3b5-a160-17d7-77ee-b1d00acfa20d@yandex.ru> <92da07bd02a6cc861e1a@heytings.org> <837d3lzv8n.fsf@gnu.org> <2c8d6755-cfe2-6559-3fde-3fa30ffb411e@yandex.ru> <83mtcgy44k.fsf@gnu.org> <83k07jx5jn.fsf@gnu.org> <866e510d-a060-7daa-d002-97861d056fa7@yandex.ru> <1144021660321893@iva5-64778ce1ba26.qloud-c.yandex.net> <12348081660379417@sas2-a098efd00d24.qloud-c.yandex.net> <66bbbb95983414e79637@heytings.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="GqC2JEhLGI" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11259"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 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 Sat Aug 13 19:44:13 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 1oMvBE-0002iH-3x for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Aug 2022 19:44:12 +0200 Original-Received: from localhost ([::1]:36452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMvBC-0004mD-N1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Aug 2022 13:44:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMvB4-0004lD-8x for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 13:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45295) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMvB3-0007gT-Vy for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 13:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oMvB3-0007W7-QN for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 13:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Aug 2022 17:44:01 +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.166041263028870 (code B ref 56682); Sat, 13 Aug 2022 17:44:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 13 Aug 2022 17:43:50 +0000 Original-Received: from localhost ([127.0.0.1]:35044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMvAr-0007Va-OI for submit@debbugs.gnu.org; Sat, 13 Aug 2022 13:43:50 -0400 Original-Received: from heytings.org ([95.142.160.155]:51594) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMvAp-0007VR-Rh for 56682@debbugs.gnu.org; Sat, 13 Aug 2022 13:43:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1660412626; bh=9AMx83TuXuy39IFEDsViLo8mUAZr5Fnl+ON/nYsIWLE=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=wbZP7Yo3welc2DQ7gdHnQ2U3ul8TOaeQ+S8qsYRkQeAisoePiKDUU+tqYzmSbQD/T qOzv5Ojir+N61OsSBdtpPlqkFlBMLAF0GktkFaf+a4vcuQdtR2yCeqSqewa8nkvnra TOSk7iiDmkoeVpfFMUNV+u9cf6LgHM+g1mZACWwud05Jvs9kE2PapjnH5BlmmYBCwA Ha4cfVEsbMOyMjvOgiBASckRcD9NQh3jJBF9DJ1KVqT/hOjScxhRCx3Btb50w9GeV1 e553LBArZ66FooyB9ec9eDcqMXSurxOvDN4cVFewvqhw3bcKcKbd81EkDk3jwSIrss rAQanjCVtxXTQ== In-Reply-To: Content-ID: <66bbbb959802b3ee0653@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:239576 Archived-At: --GqC2JEhLGI Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-ID: <66bbbb9598b566ad05af@heytings.org> >> I already did, and told you that these multi-second delays were still=20 >> present in larger JSON files (and therefore also in smaller files with= =20 >> slower CPUs). > > Delays or "a delay"? Just the first time you scroll to EOB? Or did you=20 > do the whole dance with editing near BOB, then goto EOB, and repeat? > Delays. When scrolling to EOB and when using isearch, for example. >>> Then the goal failed because we don't disable bidi hpa? It has a much= =20 >>> more noticeable effect on editing that font-lock. >>=20 >> That's not correct, no.=C2=A0 The BPA algorithm makes C-n and C-p slower= at=20 >> the beginning of large files only in a very specific case: when the=20 >> beginning of the buffer contains opening brackets whose matching=20 >> closing bracket is at the end of the buffer. > > To be fair, that's pretty much all JSON files. > Again, the aim of this effort has _nothing_ to do with JSON files. > > The branch: > > 1) Allows everyone interested to evaluate the performance of=20 > unrestricted font-lock even in large files (single-line or not) and see= =20 > how big on a problem the delays caused by syntax-ppss actually are in=20 > their experience. It's an important question. > > 2) Figure out the file sizes where syntax-ppss's performance really does= =20 > become a problem. That can give us data for better defaults later. > Buffers with long lines are rare enough. It wouldn't make sense (and=20 would be a nightmare in terms of long term maintenance) to add 25=20 defcustoms to allow anyone to fine-tune what Emacs does in such buffers. > > 3) Play around with two easy solutions that we discussed previously:=20 > narrowing during font-lock (one of the values for font-lock-large-files= =20 > pretty much matches the current behavior on master), or fontifying only= =20 > the first X characters (e.g. 1000000) of the buffer, and skipping on the= =20 > rest. > > 4) It should be plain to see that implementing additional approaches=20 > should be easy enough. For instance, a hybrid like "fontify the first 1= =20 > MB correctly, and the rest - on best-effort basis". Although the value=20 > '(narrow . 1000000) should provide behavior a very similar behavior=20 > already. Maybe ever a better one: the boundaries are stable. Maybe sure= =20 > to try it together with (setq bidi-inhibit-hpa t): the result looks very= =20 > fast to me. > These 3) and 4) assume that the major (and minor) modes are well-behaving,= =20 and will obey the restrictions. Which isn't true, and was the reason why= =20 locked narrowing was introduced. --GqC2JEhLGI--