From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Sat, 13 Aug 2022 09:13:48 +0300 Message-ID: <83mtc8n00z.fsf@gnu.org> References: <640c2e07-98e1-96d6-bb02-19f5f03f637f@yandex.ru> <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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38032"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, gregory@heytings.org, dgutov@yandex.ru To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 13 08:14:12 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 1oMkPT-0009iU-MD for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Aug 2022 08:14:11 +0200 Original-Received: from localhost ([::1]:53462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMkPS-0006RV-I6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Aug 2022 02:14:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMkPK-0006RN-Ma for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 02:14:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41464) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMkPK-0000o3-DJ for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 02:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oMkPK-0003YU-6U for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 02:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Aug 2022 06:14: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.166037123713648 (code B ref 56682); Sat, 13 Aug 2022 06:14:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 13 Aug 2022 06:13:57 +0000 Original-Received: from localhost ([127.0.0.1]:59446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMkPF-0003Y4-Bz for submit@debbugs.gnu.org; Sat, 13 Aug 2022 02:13:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56040) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMkPE-0003Xs-8H for 56682@debbugs.gnu.org; Sat, 13 Aug 2022 02:13:56 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43044) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMkP7-0000nM-RX; Sat, 13 Aug 2022 02:13:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=YuBAk+JAo3fHq2xtlITNBmfkt28HjFjEL2VJsqPuDXM=; b=GF/134cV0qNC k9TJCgmv8j7RJqFQcmADPURBmtSpOf7oR1uqkZ/X0ioD9+BTGwxMs/sCmb07RMJrLJHDHcq46TnUN uUMfRgB3gzuJ6S821JiXAKW4NM/d7CPz29AVRD4XRXgoU56jqrFK8YRslr8d+6Ipgid25Dji58xx6 mW0w9SUL5L8qUWwcRz4DMdl8kckdGBvKg3pC/xyQphBdVjjhVCCuL+EtW35xuKi1DTA18oxGYKKLJ d4z8h6DbE6+QcP/sU3wGDxPMnTyB0ZPJZ312VQDcJZIIKKTTVLy+7tZTT6hpP4t8oYw/TqVHV/peq fbDHNCzgbaezyhCN/0BWVQ==; Original-Received: from [87.69.77.57] (port=2139 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMkP7-00033T-AF; Sat, 13 Aug 2022 02:13:49 -0400 In-Reply-To: (message from Stefan Monnier on Fri, 12 Aug 2022 22:01:54 -0400) 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:239488 Archived-At: > From: Stefan Monnier > Cc: Dmitry Gutov , Eli Zaretskii , > 56682@debbugs.gnu.org > Date: Fri, 12 Aug 2022 22:01:54 -0400 > > > I can only repeat that the only ways to improve font locking in a non-local > > way (or at least, the only ways that were identified in the discussions so > > far) are either to improve the speed of syntax-ppss by an order of > > magnitude, in which case it would perhaps become feasible to allow > > syntax-ppss to have access to the whole buffer, or to equip syntax-ppss with > > heuristics to make it work "as well as possible" even when it only has > > access to a portion of the buffer. > > But the locked narrowing is applied based on the presence of long-lines > rather than based on the total size of the buffer. That's true, but the two are closely related: a buffer with very long lines tends also to be a large buffer. > I think we'll want to decouple the two because they aren't quite the > same (e.g. in many cases the time taken by `syntax-ppss` doesn't depend > on the length of lines, whereas the time taken by `font-lock-keywords` > rues does not depend on the total buffer size). The solutions for stuff that depends on buffer size will indeed be different from solutions for stuff that depends on line size. However, font-lock currently depends on both, and narrowing solves both, albeit in non-specific ways.