[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Processing speed in large C++ raw strings.
From: |
Tadeus Prastowo |
Subject: |
Re: Processing speed in large C++ raw strings. |
Date: |
Sat, 27 Apr 2019 17:35:16 +0200 |
Hi Alan,
On Sat, Apr 27, 2019 at 1:37 PM Alan Mackenzie <address@hidden> wrote:
>
> Hello, Tadeus.
>
> On Fri, Apr 26, 2019 at 22:15:28 +0200, Tadeus Prastowo wrote:
> > I have not made any report since I don't feel like sparing my time to
> > collect some data for the report now that switching to text-mode does
> > the trick. So, since you are already at it, perhaps you may want to
> > find out why even scrolling the buffer in cc-mode is very slow when
> > visiting the file at
> > http://git.savannah.nongnu.org/cgit/tice.git/plain/tests/v1/test-v1_internals_program.cpp?
>
> You've submitted a bug report now. :-)
I realize that now I have enough real data :-)
> > Specifically, I built master at commit
> > 82fc8ca6ba179596928db614ab903e44968ef44e and fired the result with
> > `emacs -Q' to visit the file locally. Then, to experience the
> > sluggishness, I pressed M-> followed by M-v several times. To further
> > experience it, I started to edit some template parameters, such as
> > changing `node1' to node `node5' in line 680.
>
> Thanks for drawing my attention to this problem with lots of templates.
My pleasure. And, thank you very much for looking into this.
> The bug is that, in a certain low-level place, CC Mode was failing to
> mark the < and > "as parentheses" (with syntax-table text properties),
> hence a lot of unneeded buffer scanning was being done.
>
> The following patch should speed up the scrolling operation markedly.
> It does not become instantaneous, but takes a fraction of a second,
> compared with the several seconds it has taken up to now. Would you
> please try it out.
I apply the following patch to master at commit
8dc00b2f1e6523c634df3e24379afbe712a32b27, and I confirm that the
following patch works to solve not only the buffer scrolling
sluggishness but also the template parameter editing sluggishness,
including the one that I sent to Stefan earlier today. Thank you very
much, Alan, I really appreciate it. Three lines of a diff to solve my
two-year old sluggishness problem.
> diff -r 1940f96b9799 cc-engine.el
> --- a/cc-engine.el Fri Apr 26 01:01:07 2019 +0000
> +++ b/cc-engine.el Sat Apr 27 11:30:06 2019 +0000
> @@ -5539,7 +5539,9 @@
> (prog1 (looking-at "\\s(")
> (forward-char))))
> (backward-char)
> - (if (c-forward-<>-arglist nil) ; Should always work.
> + (if (let ((c-parse-and-markup-<>-arglists t)
> + (c-restricted-<>-arglists t))
> + (c-forward-<>-arglist nil)) ; Should always work.
> (when (> (point) to)
> (setq bound-<> (point)))
> (forward-char)))
--
Best regards,
Tadeus