From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Welch 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 22:08:21 +0000 Message-ID: References: , <20180320194843.GA5165@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_AM5P18901MB0193042603FE2B4D038A589AF8AB0AM5P18901MB0193_" X-Trace: blaine.gmane.org 1521583633 6641 195.159.176.226 (20 Mar 2018 22:07:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Mar 2018 22:07:13 +0000 (UTC) Cc: "30849@debbugs.gnu.org" <30849@debbugs.gnu.org> To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 20 23:07:08 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 1eyPPP-0001at-0z for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Mar 2018 23:07:07 +0100 Original-Received: from localhost ([::1]:51915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyPRS-0002RJ-82 for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Mar 2018 18:09:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyPRK-0002Qi-LM for bug-gnu-emacs@gnu.org; Tue, 20 Mar 2018 18:09:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyPRG-00065f-Da for bug-gnu-emacs@gnu.org; Tue, 20 Mar 2018 18:09:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36447) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eyPRG-00065b-4y; Tue, 20 Mar 2018 18:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eyPRF-0001Nu-NA; Tue, 20 Mar 2018 18:09:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Welch Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 20 Mar 2018 22:09:01 +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.15215837125285 (code B ref 30849); Tue, 20 Mar 2018 22:09:01 +0000 Original-Received: (at 30849) by debbugs.gnu.org; 20 Mar 2018 22:08:32 +0000 Original-Received: from localhost ([127.0.0.1]:44344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eyPQm-0001NB-8R for submit@debbugs.gnu.org; Tue, 20 Mar 2018 18:08:32 -0400 Original-Received: from mail-oln040092064079.outbound.protection.outlook.com ([40.92.64.79]:49297 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eyPQk-0001Mx-4d for 30849@debbugs.gnu.org; Tue, 20 Mar 2018 18:08:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6dKCMV9Yq9cH8KPdCu4jCH/4xaH6b7+24Dn+SQ9M9qU=; b=GNnyfxdRhY3PiZkvKVJDvEk7LbY2uCLatsOmb83SlRv6HGsjm+KhYF3PU216Ls8AERwZ5hV7Ln9J4CfRzytzwRdrZLMbFPrH/7hCgjv4Ps+tg9iC6BIt2WMhdmcMqVRe6J5byofYQCTs8Gy2n1beC/SJqtG+SnllUzU09DMFxPi6VwNqao8bn6EnX6EW9SmUN1Ul/zOgZdzzjBEqRLIkOnKnlmQ6KMz/Q6Mg+U/Ky2wjB2WY7fdTR4DISuMdOFMrB2mXwFWn69rY2gj0bca9jqwHZ1tUr7i+34G45n/fi8Frucq6Sy57rHtuDN3OJNv5CyeZqYmyCnFcu/A/JtgnHw== Original-Received: from VE1EUR01FT011.eop-EUR01.prod.protection.outlook.com (10.152.2.57) by VE1EUR01HT179.eop-EUR01.prod.protection.outlook.com (10.152.3.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.18; Tue, 20 Mar 2018 22:08:23 +0000 Original-Received: from AM5P18901MB0193.EURP189.PROD.OUTLOOK.COM (10.152.2.57) by VE1EUR01FT011.mail.protection.outlook.com (10.152.2.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.18 via Frontend Transport; Tue, 20 Mar 2018 22:08:23 +0000 Original-Received: from AM5P18901MB0193.EURP189.PROD.OUTLOOK.COM ([fe80::6c96:91d8:e318:88b]) by AM5P18901MB0193.EURP189.PROD.OUTLOOK.COM ([fe80::6c96:91d8:e318:88b%4]) with mapi id 15.20.0609.010; Tue, 20 Mar 2018 22:08:21 +0000 Thread-Topic: bug#30849: 27.0.50; CC-mode: very slow when parsing big C array initializer Thread-Index: AQHTwI9iYNFUhN6lH0GGRyTTjDlq56PZronw In-Reply-To: <20180320194843.GA5165@ACM> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:1F04AC9AD1C14BA290C54C76D05EA7FB9B57E2DEEE284F1DD3675A37AF211781; UpperCasedChecksum:23F709111985569F14A46E773223469208FCAFD973D18801F818B130DDF93BB4; SizeAsReceived:7173; Count:47 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Fb7j+fEeMugw8Bmshhad/gpSu6Zb7pKp] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VE1EUR01HT179; 6:K3iQ4zYCj4XOsS0rxJ6RDncSvl1xXD4hetUe6+ZyipXzbfC+g1tDwbZARfT2fvj38TUpadvOHn3unoiAe5WOWW3KywoJiSFfpm+FZ80qnSLBaMEY/szAfohzicS5Ge6G1WPElH+GWnYLdjlgg6M9rt8srtZ3F5JkvpgYI2Tx8iEwQ5D7pdXb/6SYSuRoGtaX1bEZh64+7nJTMLZyjDEgmHeB66BMZGUXdLnTr2Cn1kKbKO2K4H2eVB8Md2XR/sLFL2rPjsZaZRq553KFUoJ76GAooa6WESbtFQHgMfgwx9XayH25NYy6jzW0D/RR6CPeKdE0KSEw4yDHeTk/R2ZozD4egAVL3tLmdR3LOI13Smk=; 5:hjPwvIiLuG1h5VItUwafbWDSb+CElRAOMkIDtQ1Ed23yrxEznP/TICrcfnSuhfG0DEfkhH8MiVHShQCoekg/vAPqrlyVGSefv6+rzNNeHrHENzzIEYLyVfRe7T5PfQITP3ta+4XniGQAVtsPXLM+xHKUOP0Va81ym/Ro4iB2rTA=; 24:+tLPi85vv0070OG6+LS04wneUDV9Yaisuqc9oHxso+qiRCUYBP+YDZ+bawNLF3ZnkAj56Dtsqs6k7T8DKIiNZ2C6yTJm9eYC3rVjSlN6qiQ=; 7:hJUkHclkZH5M9ntfqJ83fdvduR0ZNOtNrQop5GuXQuReFGUXhe5FLlWhQL5FYOST4utJapJz+eAyYyZB41Kg8kFHzFg2HYoKWCN/64CnQ6KEMqqGq/iVmllOn2I10IuF6x+0AF7RWBV3Uuw/EmUnZanltGKCtVP3RfXufWsOcUsk/2Ke9fZ3EJ30b x-incomingheadercount: 47 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1601125374)(1603101448)(1701031045); SRVR:VE1EUR01HT179; x-ms-traffictypediagnostic: VE1EUR01HT179: x-ms-office365-filtering-correlation-id: d39600a2-06de-4606-a112-08d58eaf1802 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:VE1EUR01HT179; BCL:0; PCL:0; RULEID:; SRVR:VE1EUR01HT179; x-forefront-prvs: 061725F016 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR01HT179; H:AM5P18901MB0193.EURP189.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:; x-microsoft-antispam-message-info: Ls4A/iueLzAkha5q3AREu7UHYNlfhHA1fBmXkqwJ33wigloV27/RmkzP+1v+dlEu5lKeY6HbhLYIUJD+itzqcdT7xP27JnZatlw+k9HJ3XV9v8RFnbO8+8nuVj0zZ6G87H+Z99D+hYfiR6qnENgkibQTbPfVxjWMYjRFgpBf1C2Lc2dHjlQNVzMN+XM7UXBX spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: d39600a2-06de-4606-a112-08d58eaf1802 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Mar 2018 22:08:21.5570 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR01HT179 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:144473 Archived-At: --_000_AM5P18901MB0193042603FE2B4D038A589AF8AB0AM5P18901MB0193_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > 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 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 arra= y 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 > 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.1180300= 0 > 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). --_000_AM5P18901MB0193042603FE2B4D038A589AF8AB0AM5P18901MB0193_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

> Seeing as how you're using master, would you please pu= ll 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-bl= ock-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): R= eplace
>     c-looking-at-or-maybe-in-bracelist by c-inside-brac= elist-p, since the former
>     does not recognize enum brace lists, but the latter= does.
>     
>     * lisp/progmodes/cc-fonts.el (c-get-fontification-c= ontext): Replace
>     c-looking-at-or-maybe-in-bracelist by c-inside-brac= elist-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.1180= 3000
> 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).
--_000_AM5P18901MB0193042603FE2B4D038A589AF8AB0AM5P18901MB0193_--