From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs 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 Message-ID: <20180320194843.GA5165__5466.49928805909$1521579934$gmane$org@ACM> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1521579934 12429 195.159.176.226 (20 Mar 2018 21:05:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Mar 2018 21:05:34 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: 30849@debbugs.gnu.org To: David Welch Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 20 22:05:30 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eyORh-00033P-AV for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Mar 2018 22:05:25 +0100 Original-Received: from localhost ([::1]:51747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyOTk-0000VS-IH for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Mar 2018 17:07:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyOTQ-0000NT-2w for bug-gnu-emacs@gnu.org; Tue, 20 Mar 2018 17:07:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyOTP-0001vi-3T for bug-gnu-emacs@gnu.org; Tue, 20 Mar 2018 17:07:12 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36400) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eyOTJ-0001qi-Le; Tue, 20 Mar 2018 17:07:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eyOTG-0006Q4-AA; Tue, 20 Mar 2018 17:07:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 20 Mar 2018 21:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30849 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 30849-submit@debbugs.gnu.org id=B30849.152158002024669 (code B ref 30849); Tue, 20 Mar 2018 21:07:02 +0000 Original-Received: (at 30849) by debbugs.gnu.org; 20 Mar 2018 21:07:00 +0000 Original-Received: from localhost ([127.0.0.1]:44297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eyOTE-0006Po-2I for submit@debbugs.gnu.org; Tue, 20 Mar 2018 17:07:00 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:64234 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1eyOTB-0006Pg-V3 for 30849@debbugs.gnu.org; Tue, 20 Mar 2018 17:06:58 -0400 Original-Received: (qmail 18424 invoked by uid 3782); 20 Mar 2018 21:06:57 -0000 Original-Received: from acm.muc.de (p548C7B48.dip0.t-ipconnect.de [84.140.123.72]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 20 Mar 2018 22:06:56 +0100 Original-Received: (qmail 17350 invoked by uid 1000); 20 Mar 2018 19:48:43 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:144467 Archived-At: 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 > 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).