Subject: Re: bug#69071: Emacs master branch: c-ts-mode is slow with large C functions.

From: Kévin Le Gouguec <[email-masked]>
Date: Mon, 12 Feb 2024 14:14:05 +0100

Alan Mackenzie <[email-masked]> writes:

> Hello, Emacs.
>
> Using Emacs master:
>
> c-ts-mode is slow on large C functions when editing towards the end of
> such a function.
>
> As an extreme example, there is a function proto_register_rrc in the
> file packet-rrc.c which is part of Wireshark.  This file is "available"
> from Github, but sadly no longer freely available - you need to allow
> Microsoft's scripts to run on your machine.  I'm willing to send this
> file by email to anybody who needs it.  It is almost 10 MB in size.

Assuming we are talking about the same 10 MB file:

  $ wget https://raw.githubusercontent.com/wireshark/wireshark/master/epan/dissectors/packet-rrc.c

or

  $ git clone --depth 1 https://github.com/wireshark/wireshark 
  $ find wireshark -name packet-rrc.c

might help?

I'd suggest heeding that repository's disclaimer and using the canonical
GitLab repo instead of the read-only GitHub mirror, but odds are
gitlab.com's JS won't fare better on the freedom front.  Debian's mirror
might?

https://salsa.debian.org/debian/wireshark/-/blob/debian/master/epan/dissectors/packet-rrc.c

> proto_register_rrc is around 50,000 lines long, total size about 2¼ MB.
>
> Near the end of the function, after typing a character, there is a delay
> of between 9 and 10 seconds (on my 7 year old machine) before redisplay
> happens.  This is too long.  Some optimisation seems needed.
>
> On disabling font-lock-mode, the response becomes instantaneous.