From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Alan Mackenzie <acm@muc.de>, 69071@debbugs.gnu.org
Subject: bug#69071: Emacs master branch: c-ts-mode is slow with large C functions.
Date: Mon, 19 Feb 2024 21:49:26 -0800 [thread overview]
Message-ID: <0C0D2B19-C026-4719-97C0-7F450F12D92A@gmail.com> (raw)
In-Reply-To: <7178B3F3-CCD7-4A2B-9F29-DFF78A6BA243@gmail.com>
> On Feb 15, 2024, at 8:06 PM, Yuan Fu <casouri@gmail.com> wrote:
>
>
>
>> On Feb 15, 2024, at 12:36 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> Date: Mon, 12 Feb 2024 11:30:00 +0000
>>> From: Alan Mackenzie <acm@muc.de>
>>>
>>> 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.
>>>
>>> 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.
>>
>> Yuan, could you please look into this?
>
> Oops, didn’t see this. I’ll take a look.
Before we continue, let me note that this seems like another case where tree-sitter-c parser chokes on some extreme C code. Profiler reports shows that almost all time are spent in treesit-parser-root-node, which indicates that all the time are spent parsing the text.
Yuan
6094 61% - ...
5542 55% - self-insert-command
5542 55% - electric-indent-post-self-insert-function
5542 55% - indent-according-to-mode
5542 55% - treesit-indent
5542 55% - let*
5542 55% - treesit--indent-1
5542 55% - let*
5542 55% - cond
5542 55% - treesit-node-at
5542 55% - let*
5542 55% - if
5542 55% - or
5542 55% - treesit-buffer-root-node
5542 55% - let*
5542 55% - if
5542 55% treesit-parser-root-node
552 5% + #<compiled 0x1812af33e570332e>
3834 38% - redisplay_internal (C function)
3824 38% - redisplay--pre-redisplay-functions
3824 38% - run-hook-with-args
3824 38% - treesit--pre-redisplay
3824 38% - if
3824 38% - let
3824 38% - while
3824 38% - let
3824 38% treesit-parser-root-node
5 0% + command-execute
5 0% + timer-event-handler
next prev parent reply other threads:[~2024-02-20 5:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 11:30 bug#69071: Emacs master branch: c-ts-mode is slow with large C functions Alan Mackenzie
2024-02-12 13:14 ` Kévin Le Gouguec
2024-02-15 8:36 ` Eli Zaretskii
2024-02-16 4:06 ` Yuan Fu
2024-02-20 5:49 ` Yuan Fu [this message]
2024-02-20 13:55 ` Eli Zaretskii
2024-02-24 20:35 ` Yuan Fu
2024-02-25 5:48 ` Eli Zaretskii
2024-03-01 1:26 ` Yuan Fu
2024-03-01 7:09 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0C0D2B19-C026-4719-97C0-7F450F12D92A@gmail.com \
--to=casouri@gmail.com \
--cc=69071@debbugs.gnu.org \
--cc=acm@muc.de \
--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.