unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Theodor Thornhill <theo@thornhill.no>
Cc: 43631@debbugs.gnu.org
Subject: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt
Date: Mon, 28 Sep 2020 19:33:25 +0000	[thread overview]
Message-ID: <20200928193325.GA7626@ACM> (raw)
In-Reply-To: <87pn67312v.fsf@thornhill.no>

Hello, Theo.

On Sun, Sep 27, 2020 at 13:34:32 +0200, Theodor Thornhill wrote:
> Eli Zaretskii <eliz@gnu.org> writes:

> [...]


> > But I'm confused why the "fast" profile starts with
> > font-lock-fontify-region, whereas the "slow" profile doesn't have
> > font-lock-fontify-region anywhere...

> I see that when I remove 'c-before-change-check-unbalanced-strings from
> 'c-get-state-before-change-functions' the performance degradation
> ceases.  I'm not sure what else is affected by that change, so not sure
> if that can be counted as a fix as far as 'csharp-mode' is concerned.

I would strongly recommend you not to make such a change, at least not
without a good deal of matching changes elsewhere.  ;-)

It seems the bit in c-b-c-check-unbalanced-strings dealing with
multiline strings was written on the assumption that buffers containing
such would be small.

With multiline strings, _any_ change involving quote characters can flip
the string/non-string characterisation from point all the way to the end
of the buffer.  In the worst case scenario, this potentially big region
needs to be analysed and have syntax-table text properties throughout
the entire region changed.

The current problem is that c-b-c-check-u-strings is doing this analysis
for every buffer change.  This was easier to code, but has led to
performance problems on buffers which aren't small.  The solution to
this will have to involve restricting this analysis to when quote marks
or the c-multiline-string-start-char get inserted or removed.  That way,
there should only be an occasional and tolerable delay when one of these
characters is inserted/removed.

I'll be looking at this in the coming days.

> Just wanted to let you know.

> Theo

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2020-09-28 19:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26 11:17 bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-26 11:41 ` Eli Zaretskii
2020-09-26 12:40   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-26 13:43     ` Eli Zaretskii
2020-09-26 16:03       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-26 16:17         ` Eli Zaretskii
2020-09-26 19:43           ` Dmitry Gutov
2020-09-27  9:54           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-27 11:34           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-28 19:33             ` Alan Mackenzie [this message]
2020-09-28 19:41               ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-13 15:26 ` Alan Mackenzie

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=20200928193325.GA7626@ACM \
    --to=acm@muc.de \
    --cc=43631@debbugs.gnu.org \
    --cc=theo@thornhill.no \
    /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).