GNU bug report logs - #59738
c-ts-mode is slow with large buffers.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Thu, 1 Dec 2022 11:51:02 UTC

Severity: normal

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Yuan Fu <yuf011 <at> ucsd.edu>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 59738 <at> debbugs.gnu.org
Subject: bug#59738: c-ts-mode is slow with large buffers.
Date: Sat, 3 Dec 2022 02:37:08 -0800
Alan Mackenzie <acm <at> muc.de> writes:

> Hello, Emacs.
>
> In an up to date (2022-11-30) master started as $ emacs --no-desktop:
>
> The file .../drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_sh_mask.h
> in the Linux source tree is 6.8 MB big, consisting of a large number of
> #defines and comments, but nothing else.
>
> To scroll through it in c-ts-mode takes a little over 26 minutes on my
> system.  By comparison, in C Mode it takes 31 seconds.  There would
> appear to be a need for some optimisation in c-ts-mode, here.
>
>
> The file
> https://gitlab.com/wireshark/wireshark/-/raw/master/epan/dissectors/packet-rrc.c
> (see bug #45248) (10 MB) takes 578 seconds to scroll in c-ts-mode.  It
> scrolls through the first 83% of the buffer rapidly, then chokes on a big
> brace block initialisation.  Also, the font-locking fails part way
> through this brace block (without any apparent speed up).
>
> For comparison, the scrolling takes 30 seconds in C Mode.  There seems to
> be a need for optimisation of c-ts-mode in this case, too.
>
>
> For completeness, I used M-: (time-scroll) in the following for the
> timings:
>
> (defmacro time-it (&rest forms)
>   "Time the running of a sequence of forms using `float-time'.
> Call like this: \"M-: (time-it (foo ...) (bar ...) ...)\"."
>   `(let ((start (float-time)))
>     ,@forms
>     (- (float-time) start)))
>
> (defun time-scroll (&optional arg)
>   (interactive "P")
>   (message "%s"
>            (time-it
>             (condition-case nil
>                 (while t
>                   (if arg (scroll-down) (scroll-up))
>                   (sit-for 0))
>               (error nil)))))

Thanks for the report! I’m a bit overwelmed by all the open bug reports
right now, but I’ll be sure to investigate it as soon as I’m able.

Yuan




This bug report was last modified 2 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.