unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: larsi@gnus.org, emacs-devel@gnu.org, gregory@heytings.org
Subject: Re: How the long-lines "optimisation" breaks font locking.
Date: Thu, 04 Aug 2022 15:54:34 +0300	[thread overview]
Message-ID: <83sfmc2mph.fsf@gnu.org> (raw)
In-Reply-To: <Yuui9U0pg1QekfrO@ACM> (message from Alan Mackenzie on Thu, 4 Aug 2022 10:44:05 +0000)

> Date: Thu, 4 Aug 2022 10:44:05 +0000
> Cc: emacs-devel@gnu.org, Gregory Heytings <gregory@heytings.org>
> From: Alan Mackenzie <acm@muc.de>
> 
> Hello, Lars.
> 
> On Wed, Aug 03, 2022 at 21:03:56 +0200, Lars Ingebrigtsen wrote:
> > Alan Mackenzie <acm@muc.de> writes:
> 
> > > I don't think it is improbable that a C++ hacker will create a long line
> > > in a raw string.
> 
> > If you don't think that's improbable, then you should like the new
> > optimisations a lot -- ....
> 
> These "optimisations" break CC Mode.

They don't "break" it, they cause it occasionally produce inaccurate
fontifications.  And only when otherwise Emacs becomes unusable.

> > .... because if you, instead of a 10K line in that C++ file, inserted
> > a 1M line, then Emacs would previously hang indefinitely, but with the
> > optimisation, it doesn't.
> 
> Well I tried CC Mode with a 1,000,000 character raw string.  It was
> indeed a bit sluggish but "hang indefinitely" is an exaggeration.

Try it with a 20MB raw string, then.  And, for good measure, in an
unoptimized build.  These are the cases we are trying to make
workable.

If all you are saying is that the default value of long-line-threshold
is too low, we can definitely discuss a better value.

> Having loaded the file in C++ Mode (without the spiking of
> narrow-to-region and widen), it took 90 seconds for M-> (first time).

And you consider that reasonable?

> Moving point was sluggish, taking perhaps 1 to 3 seconds, as did
> scrolling by a screenful.

Did you try moving and the beginning of the buffer or at its end?  The
speed is very different.

> Inserting text in the middle of the line caused an overflow in the
> regexp engine stack.  Interfering with the raw string delimiters
> (specifically, changing the identifier in the delimiter at either
> end of the string) again took 90 seconds.

And this is in your opinion reasonable performance?

> Doing these things in the current master branch indeed appeared to be
> fast, but at one point an error in an after-change-function caused
> after-change-functions to get set to nil, crashing CC Mode.

If you can show a recipe for this problem, we will fix it.  This code
is WIP, so some problems definitely remain and should be reported and
fixed.



  reply	other threads:[~2022-08-04 12:54 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03 18:39 How the long-lines "optimisation" breaks font locking Alan Mackenzie
2022-08-03 19:03 ` Lars Ingebrigtsen
2022-08-04 10:44   ` Alan Mackenzie
2022-08-04 12:54     ` Eli Zaretskii [this message]
2022-08-04 14:44       ` Alan Mackenzie
2022-08-04 14:52         ` Lars Ingebrigtsen
2022-08-04 15:22         ` Gregory Heytings
2022-08-05  1:23           ` Ihor Radchenko
2022-08-04 16:09         ` Eli Zaretskii
2022-08-05 10:56       ` Alan Mackenzie
2022-08-05 11:20         ` Eli Zaretskii
2022-08-05 13:04           ` Dmitry Gutov
2022-08-05 14:22             ` Eli Zaretskii
2022-08-05 14:29               ` Dmitry Gutov
2022-08-05 15:30                 ` Eli Zaretskii
2022-08-05 19:50                   ` Dmitry Gutov
2022-08-06  5:36                     ` Eli Zaretskii
2022-08-06 10:54                       ` Dmitry Gutov
2022-08-04 13:11     ` Eric S Fraga
2022-08-04 13:34       ` Po Lu
2022-08-04 14:38         ` Eric S Fraga
2022-08-04 16:16           ` SOLVED: " Eric S Fraga
2022-08-04 16:21             ` Eric S Fraga
2022-08-04 17:36               ` Stefan Kangas
2022-08-05  9:36                 ` Eric S Fraga
2022-08-05 11:13                   ` Eli Zaretskii
2022-08-05 12:28                     ` Eric S Fraga
2022-08-05 13:40                       ` Eric S Fraga
2022-08-05 23:11                         ` Tim Cross
2022-08-05 23:23                         ` Lars Ingebrigtsen
2022-08-08 11:51                           ` Fraga, Eric
2022-08-03 19:15 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83sfmc2mph.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).