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: Sun, 31 Jul 2022 23:12:32 +0000 Message-ID: <8c7321f2f336523624e3@heytings.org> References: <837d46mjen.fsf@gnu.org> <8a3eaeef01be5bfaa5ef@heytings.org> <05388e8d8812bfa3695d@heytings.org> <83v8rf5894.fsf@gnu.org> <65cb7c73fd4a999cca00@heytings.org> <8c7321f2f3400a5db9be@heytings.org> <8c7321f2f388e5343475@heytings.org> <8c7321f2f36494299e61@heytings.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40472"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, Eli Zaretskii To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 01 01:13: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 1oII7U-000AMG-Vp for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Aug 2022 01:13:12 +0200 Original-Received: from localhost ([::1]:37530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oII7T-0004xC-Ex for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 19:13:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oII7L-0004x0-4n for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 19:13:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oII7K-0006N1-Rs for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 19:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oII7K-00009l-JU for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 19:13: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: Sun, 31 Jul 2022 23:13: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.1659309157570 (code B ref 56682); Sun, 31 Jul 2022 23:13:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 31 Jul 2022 23:12:37 +0000 Original-Received: from localhost ([127.0.0.1]:38809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oII6v-000097-9e for submit@debbugs.gnu.org; Sun, 31 Jul 2022 19:12:37 -0400 Original-Received: from heytings.org ([95.142.160.155]:32926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oII6r-00008w-Sb for 56682@debbugs.gnu.org; Sun, 31 Jul 2022 19:12:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659309152; bh=xRoiX8eaQ1qJAkbozzpBCFzi6JZvY0sw3m6WkfN++Vw=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=K8KZNFFjXDuDnvfmHV7WGGqq2bI/0i8Vx4GFCorSUvheVjkMnyKaKG5dniLF+cy3E V7Kx8Bi/yfkOZxMF9B4x2GnBOc3f6kE6IuNd93psMBK8sKQQDhlnJG1aqHYh3t2xjK RR7/+rflGxZoKrSL8aD85Z1/MqJaPzI3P8IZZrsqp7kFuJSK0VJ+EvxqUBChap9c64 2huCxpLcK3qmgzWGc5DR5sK7jxVcNA8R1N1gJlUhrdPVxSfZ5lvMF4C6PfvWFC0nNA 38Ia4yQmamWetn/TYuHdUoGJxXfBPNNO37KPB5kUnUCJSeKEalnHU8y//YMJk9o2rx DoxFmjoQYkMdw== In-Reply-To: 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:238378 Archived-At: >>> Let's focus on making it easy to make it work well, rather than making >>> it impossible to make it work poorly. >> >> You lost me here. I've read that sentence twenty times, and cannot >> understand what you mean. > > Your current code makes it impossible for a major mode to make Emacs > slow by widening in a too-long-line. > Which is a good thing, isn't it? Or do you think that it's okay for Emacs to become unresponsive just because it is busy highlighting characters in the buffer? > > I'd prefer if we made it easy (i.e. the default) for Emacs to work well > in that case, without making it impossible for the major mode to mess > things up. > Sure, I would also welcome a better solution. Until it materializes, the only reasonable way is to use a less optimal solution. > > For specific languages, you can use various heuristics to guess which > quotes start and which quotes end a string (for some languages you can > even do it reliably), but `syntax-ppss` handles all kinds of languages > (and doesn't have access to such heuristics currently), such as ELisp > where it's hard to do it well. > Don't worry, I've not yet seen an Elisp file with long lines. If using various heuristics is sometimes or often feasible, that's already a good thing. > > I'd prefer to first see concrete examples where speeding up the > "syntax-ppss in a 1GB buffer" would make a significant difference to the > end-user's experience. > I just sent one such example to Dmitry. And I pointed to another possible solution, namely to scan the whole buffer while opening it (instead of scanning it lazily, which is IIUC what currently happens). From a user viewpoint, it's understandable that opening a big file takes some time. > > Then we can think about what's the better way to solve the problem > (which may be to just give up on font-lock altogether, > That would be regrettable, given the amount of effort that has been put into making font-lock work "as much as possible". > > or maybe to refine the `syntax.el` code (maybe move some of it to C), or > to speed up `parse-partial-sexp`, or maybe let major modes provide those > heuristics to find a "safe point" again (these used to exist, see > `syntax-begin-function`, for example, but they tended to suck)). > All this is possible.