[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30367: 26.0.91; CC-Mode: Major slowdown when isearching big C++ file

From: Bastian Beischer
Subject: bug#30367: 26.0.91; CC-Mode: Major slowdown when isearching big C++ file.
Date: Wed, 7 Feb 2018 16:27:35 +0100

Hello Alan,

On Wed, Feb 7, 2018 at 4:24 PM, Alan Mackenzie <address@hidden> wrote:
Hello, Bastian.

In article <mailman.8662.1517913372.address@hidden> 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.

Sure, but ​I will send you the file off-list, since I don't want it to become public.

> I traced the problem back to this commit:

> Author: Alan Mackenzie <address@hidden>
> 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

> 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
address@hidden.  Sometimes a CC Mode dump produced by C-c C-b can
be useful, though I don't think it would help much here.

​Sorry, I didn't know that and will do it next time!

> 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).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]