all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: David Welch <davidwelch158@hotmail.com>
Cc: 30849@debbugs.gnu.org
Subject: bug#30849: 27.0.50; CC-mode: very slow when parsing big C array initializer
Date: Tue, 20 Mar 2018 19:48:43 +0000	[thread overview]
Message-ID: <20180320194843.GA5165__5466.49928805909$1521579934$gmane$org@ACM> (raw)
In-Reply-To: <AM5P18901MB0193C78784122E81321E22A2F8D50@AM5P18901MB0193.EURP189.PROD.OUTLOOK.COM>

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

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.

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	other threads:[~2018-03-20 19:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-18 18:04 bug#30849: 27.0.50; CC-mode: very slow when parsing big C array initializer David Welch
2018-03-20 19:48 ` Alan Mackenzie [this message]
     [not found] ` <20180320194843.GA5165@ACM>
2018-03-20 22:08   ` David Welch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20180320194843.GA5165__5466.49928805909$1521579934$gmane$org@ACM' \
    --to=acm@muc.de \
    --cc=30849@debbugs.gnu.org \
    --cc=davidwelch158@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.