Hello, Bastian.
In article <mailman.8662.1517913372.27995.bug-gnu-emacs@gnu.org > you wrote:
> After updating CC-Mode to the latest version in the standalone mercurial
> repository I noticed that searching large C++ files has become a lot
> slower than before (factor 20 or so).
Thanks for taking the trouble to report this bug.
How large is large? Any chance you could supply me with such a sample
C++ file that is slow on searching. Then, in case something else
besides the size is slowing it down, I'll have a "working" file to
diagnose the bug with.
> I traced the problem back to this commit:
> Author: Alan Mackenzie <bug-cc-mode@gnu.org>
> Date: Sun Jan 21 18:05:41 2018 +0000
> Handle C99 Compound Literals in return statements and argument lists.
>
> * cc-engine.el (c-looking-at-or-maybe-in-bracelist): Recognize a brace list
> when preceded by "return" or inside parentheses, either immediately after the
> "(" or following a comma.
> (c-looking-at-inexpr-block): Test c-has-compound-literals rather than hard
> coded C++ Mode.
> (c-guess-basic-syntax, CASE 7B): Test additionally for not being just inside a
> parenthesis or being at a Java "new" keyword. CASE 9: Remove the simple
> minded test on the contents of a block to determine a brace list.
>
> * cc-langs.el (c-has-compound-literals): New lang const and lang var.
>
> * bracelist-30.{c,res}: New test files.
Thanks for getting this information. This should help track down the
problem.
> I am attaching the result of a run of the emacs profiler before
> ("fast.profile") and after the commit ("slow.profile"). In this run I
> started emacs as:
> emacs -Q /path/to/big/file.C -e "(add-to-list 'load-path ~/cc-mode)" -e "(require 'cc-mode)"
> M-x profiler-start
> C-s searchString
> M-x profiler-report
> And write the result to 'slow.profile' and 'fast.profile'
> respectively. It appears that 93% of the time is spent in
> c-looking-at-or-maybe-in-bracelist.
> Thanks for looking into this issue!
Just as a matter of interest, you can post CC Mode bugs direct to
bug-cc-mode@gnu.org. Sometimes a CC Mode dump produced by C-c C-b can
be useful, though I don't think it would help much here.
> In GNU Emacs 26.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
> of 2018-02-06 built on beischer-w520
> Repository revision: c787a4968273027960a20ced6d63bae0d1ffa87e
> Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
[ .... ]
--
Alan Mackenzie (Nuremberg, Germany).