GNU bug report logs -
#30849
27.0.50; CC-mode: very slow when parsing big C array initializer
Previous Next
Reported by: David Welch <davidwelch158 <at> hotmail.com>
Date: Sun, 18 Mar 2018 18:18:01 UTC
Severity: normal
Merged with 30367
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
Message #11 received at 30849 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> 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 <at> muc.de>
Sent: 20 March 2018 19:48
To: David Welch
Cc: 30849 <at> 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 <at> 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).
[Message part 2 (text/html, inline)]
This bug report was last modified 7 years and 57 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.