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

Previous Next

Packages: emacs, cc-mode;

Reported by: Bastian Beischer <bastian.beischer <at> gmail.com>

Date: Tue, 6 Feb 2018 10:36:02 UTC

Severity: normal

Merged with 30849

Found in versions 26.0.91, 27.0.50

Fixed in version 27.1

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Bastian Beischer <bastian.beischer <at> gmail.com>
Cc: 30367 <at> debbugs.gnu.org
Subject: bug#30367: 26.0.91; CC-Mode: Major slowdown when isearching big C++ file.
Date: 7 Feb 2018 15:24:35 -0000
Hello, Bastian.

In article <mailman.8662.1517913372.27995.bug-gnu-emacs <at> 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 <at> 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 <at> 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).





This bug report was last modified 7 years and 114 days ago.

Previous Next


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