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: acm@muc.de, casouri@gmail.com, 59738@debbugs.gnu.org
Subject: bug#59738: c-ts-mode is slow with large buffers.
Date: Sun, 11 Dec 2022 18:39:46 +0000	[thread overview]
Message-ID: <Y5Yj8hfujZnIPpDA@ACM> (raw)
In-Reply-To: <83edt5u9gv.fsf@gnu.org>

Hello, Eli.

On Sun, Dec 11, 2022 at 19:38:24 +0200, Eli Zaretskii wrote:
> > Date: Sun, 11 Dec 2022 17:13:49 +0000
> > Cc: casouri@gmail.com, 59738@debbugs.gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > > You do all your measurements in an optimized build of Emacs.  I did
> > > mine in an unoptimized build, something that I need to use all the
> > > time, even though my production sessions run optimized builds.  In an
> > > unoptimized build CC Mode is extremely slow.

> > I've built an emacs-29 with CFLAGS='-O0 -g3', --with-native-compilation,
> > and --with-enable-checking=all.  Just about anything is slow in such a
> > build.  For example, converting the org mode manual from .org to .texi
> > took ~15 minutes in the bootstrap.

> The time it takes to build the Org manual doesn't bother me, since it
> is rarely redone, and is not part of my maintenance job.  Also, in my
> builds I get to producing the Org manual when the Lisp files are
> already byte-compiled, so it takes much less than 15 min.  And
> finally, I almost never bootstrap.

I was advancing that figure merely as a measure of how slow such a build
is.

> > Do you really need to run in such a build all the time?

> It is impossible to debug Emacs efficiently on the C level using the
> optimized build.  So yes, I'm using unoptimized builds quite a lot.

I use an optimised build for running and debugging at the Lisp level.
Occasionally I need C debugging, and so run in an "ordinary" debugging
build (3 times as slow) on these occasions.  I think I've only once or
twice needed a super-slow build (with --with-enable-checking=all) for
debugging.

My question was to enquire as to whether you actually really need the 10x
as slow build most of the time, or whether the normal 3x as slow (normal
debugging) build or even an optimised build would suffice most of the
time.

> > > For example, just visiting dce_12_0_sh_mask.h file takes a whopping
> > > 67 sec, and M-> immediately after the file is displayed takes
> > > another 25 sec.  With c-ts-mode, these numbers are, respectively,
> > > 1.8 sec and 2 sec.

> > Yes.  I saw pretty much the same in my pessimised build.  In a normal
> > build, these operation are ~10 times as fast.  Also we're all agreed
> > dce_12_0_sh_mask.h is an unusual file, both in its content and its
> > size.

> If it is an unusual file, why did you report the slow scrolling through
> it as a bug?  We need to be consistent: either that file is legitimate
> and Emacs should work reasonably fast with it, or it isn't.

It is both an unusual file (so unusual behaviour might be expected in
Emacs with it) and fully legitimate (so Emacs should handle it with times
for scrolling operations measured in seconds, not minutes).  Up until
Yuan fixed c-ts-mode, its scrolling was indeed measured in minutes.  The
bug was legitimate, and the fix is good.

[ .... ]

> > > Speed is not the main reason why we want to have font-lock and
> > > indentation based on a parser library.  The main reason is
> > > _correctness_ and _accuracy_.  A regexp-based fontification and
> > > indentation engines will never be able to match parser-based
> > > engines, because they doesn't really understand the source code.

> > Given the current CC Mode, any increase in correctness is going to be
> > marginal, if apparent at all.

> I disagree.  Both C and C++ are still evolving, and their syntax and
> semantics don't become simpler.  People post bug reports against CC
> Mode which involve some tricky syntactical constructs all the time.

Yes.  It remains to be seen if the tree-sitter grammars handle these
unusual constructs effortlessly.  I somehow suspect it won't be as simple
as all that.  Yuan has already raised a bug in the C grammar where it
doesn't handle packet-rrc.c correctly.

> Our current font-lock is just a huge collection of ad-hocery, and
> there's a limit to what we can do with ad-hoc code.  Personally, I
> think this is an evolutionary dead end.  It was acceptable years ago,
> when the incremental parsing technology was not developed enough
> and/or not accessible easily enough.

We're in violent agreement, here.  ;-)

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2022-12-11 18:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 11:50 bug#59738: c-ts-mode is slow with large buffers Alan Mackenzie
2022-12-03 10:37 ` Yuan Fu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-07  4:56 ` Yuan Fu
2022-12-07 17:23   ` Eli Zaretskii
2022-12-08  0:40     ` Yuan Fu
2022-12-08 20:37       ` Eli Zaretskii
2022-12-10 21:34         ` Alan Mackenzie
2022-12-10 23:14           ` Yuan Fu
2022-12-11  7:25             ` Eli Zaretskii
2022-12-11 13:22             ` Alan Mackenzie
2022-12-11 16:38               ` Dmitry Gutov
2022-12-11  6:45           ` Eli Zaretskii
2022-12-11 17:13             ` Alan Mackenzie
2022-12-11 17:38               ` Eli Zaretskii
2022-12-11 18:39                 ` Alan Mackenzie [this message]
2022-12-11 19:14                   ` Eli Zaretskii
2022-12-13  1:20           ` Stefan Kangas
2022-12-07 14:34 ` Eli Zaretskii
2022-12-07 14:58   ` Eli Zaretskii
2022-12-07 15:46   ` Alan Mackenzie
2023-01-07 23:08 ` Yuan Fu

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=Y5Yj8hfujZnIPpDA@ACM \
    --to=acm@muc.de \
    --cc=59738@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=eliz@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.