bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#30849: 27.0.50; CC-mode: very slow when parsing big C array initiali


From: David Welch
Subject: bug#30849: 27.0.50; CC-mode: very slow when parsing big C array initializer
Date: Tue, 20 Mar 2018 22:08:21 +0000

> Seeing as how you're using master, would you please pull this change
> into your copy of the repository, and see if you agree with me that it
> fixes this bug.

>

Yes, thanks. That fixes the slow down for me.



From: Alan Mackenzie <acm@muc.de>
Sent: 20 March 2018 19:48
To: David Welch
Cc: 30849@debbugs.gnu.org
Subject: Re: bug#30849: 27.0.50; CC-mode: very slow when parsing big C array initializer
 
Hello, David.

On Sun, Mar 18, 2018 at 18:04:55 +0000, David Welch wrote:

> Run 'emacs -Q bar.c' (this file is attached)
> Goto a line inside the initializer e.g. 'M-x goto-line RET 9522'
> emacs will hang for ~50 seconds on a 100% cpu on a Intel i7 @ 3.40GHz.

Yes.  This isn't good.

> This bug seems to be introduced by

> commit d3090a3a3e22c4b0f4e0e833942f5942eb392c51 (HEAD, refs/bisect/bad)
> Author: Alan Mackenzie <acm@muc.de>
> Date:   Fri Feb 2 20:46:35 2018 +0000

>     CC Mode: Fix an enum intro being parsed as defun-block-intro
>     
>     * lisp/progmodes/cc-engine.el (c-inside-bracelist-p): Return a bufpos rather
>     than t for the enum case.
>     (c-add-stmt-syntax, c-guess-continued-construct): Replace
>     c-looking-at-or-maybe-in-bracelist by c-inside-bracelist-p, since the former
>     does not recognize enum brace lists, but the latter does.
>     
>     * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Replace
>     c-looking-at-or-maybe-in-bracelist by c-inside-bracelist-p.

> I generated a profile and 95% of time is spent in c-inside-bracelist-p
> called from c-get-fontification-context.

Thanks for taking the trouble to report this, and thanks for researching
the cause.

I think this bug is a duplicate of bug #30367, for which I've just
committed commit 16559146f9db1b36d5e8b6c92edb5bb36fafdb85 to savannah.
(Thanks for giving me a nudge, here.)

> In GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.25)
>  of 2018-03-17 built on lgw01-amd64-055
> Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
> System Description: Ubuntu 17.10



Bear in mind that in such an unusual source file (with a ~17,500 line
array initialisation), CC Mode is going to take some time to analyse
things.  But taking nearly a minute to draw a screen is outside the
bounds of acceptability.

--
Alan Mackenzie (Nuremberg, Germany).

reply via email to

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