all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: A possible way for CC Mode to resolve its sluggishness
Date: Fri, 26 Apr 2019 20:11:41 +0000	[thread overview]
Message-ID: <20190426201141.GD4720@ACM> (raw)
In-Reply-To: <83k1fgwnkq.fsf@gnu.org>

Hello, Eli.

On Fri, Apr 26, 2019 at 22:53:09 +0300, Eli Zaretskii wrote:
> > Date: Fri, 26 Apr 2019 19:30:56 +0000
> > From: Alan Mackenzie <acm@muc.de>

> > (i) A CC Mode buffer will be partitioned into @dfn{syntactic cells}.
> > These will be things like a section of code, a comment, a string, a raw
> > string, a CPP construct ....  Possibly even comment delimiters would
> > have their own cells.

> > (ii) Syntactic cells will be implemented by a text property, c-syntax,
> > whose value will indicate the type of the cell, and possibly an
> > identifier for it.  Neighbouring cells will always have distinct
> > c-syntax values.

> Can a syntactic cell have other syntactic cells embedded in it?

No.  Mainly because ....

> Because if it can, you cannot use text properties for that, since text
> properties cannot overlap.

Yes.

> > Thoughts?

> Why do you think this proposal will make CC Mode faster?  Wouldn't
> computing and updating the cells in itself be expensive?

The main speed up will come from only running CC Mode's change functions
occasionally, rather than at every buffer change.

For most changes, there will be no need explicitly to update the cells;
the text property stickiness, and so on, will do that implicitly.  When
there is a need, the cell boundaries will be calculated by existing
algorithms, but these will get run much less frequently.

For example c-fl-decl-start laboriously finds the start of the current
declaration, needed as a context for accurate font-locking.  The
syntactic cells will cache this value, rather than it having to be
continually calculated.  This function is one of the main brakes to CC
Mode's performance.

Also, there are currently a lot of calls to c-literal-limits and
friends, which use an explicit cache together with parse-partial-sexp.
Being able to use text property search instead should be a speedup.

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2019-04-26 20:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 19:30 A possible way for CC Mode to resolve its sluggishness Alan Mackenzie
2019-04-26 19:53 ` Eli Zaretskii
2019-04-26 20:11   ` Alan Mackenzie [this message]
2019-04-27  2:10 ` Stefan Monnier
2019-04-27  3:34   ` Óscar Fuentes
2019-04-27 13:57   ` Alan Mackenzie
2019-04-28 17:32     ` Stephen Leake
2019-04-29  1:46     ` Stefan Monnier
2019-04-29  9:23       ` Alan Mackenzie
2019-04-29 12:19         ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=20190426201141.GD4720@ACM \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.