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#30367: 26.0.91; CC-Mode: Major slowdown when isearching big C++ file. Date: Thu, 8 Feb 2018 18:42:32 +0000 Message-ID: <20180208184232.GB4335__23714.6318461329$1518116113$gmane$org@ACM> References: <20180207152435.72040.qmail@mail.muc.de> <20180207212145.GA3963@ACM> <20180207222638.GB3963@ACM> <20180208172558.GA4335@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1518116113 14861 195.159.176.226 (8 Feb 2018 18:55:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Feb 2018 18:55:13 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: 30367@debbugs.gnu.org To: Bastian Beischer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 08 19:55: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 1ejrLD-0001x1-Tw for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Feb 2018 19:54:40 +0100 Original-Received: from localhost ([::1]:36122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejrNF-0003LP-Ew for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Feb 2018 13:56:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejrKj-0000mW-Mo for bug-gnu-emacs@gnu.org; Thu, 08 Feb 2018 13:54:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejrKi-0007iw-G7 for bug-gnu-emacs@gnu.org; Thu, 08 Feb 2018 13:54:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejrKc-0007dE-Mb; Thu, 08 Feb 2018 13:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ejrKc-0003Dm-CC; Thu, 08 Feb 2018 13:54:02 -0500 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: Thu, 08 Feb 2018 18:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30367 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 30367-submit@debbugs.gnu.org id=B30367.151811598512316 (code B ref 30367); Thu, 08 Feb 2018 18:54:02 +0000 Original-Received: (at 30367) by debbugs.gnu.org; 8 Feb 2018 18:53:05 +0000 Original-Received: from localhost ([127.0.0.1]:34317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejrJh-0003Ca-AG for submit@debbugs.gnu.org; Thu, 08 Feb 2018 13:53:05 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:53861 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1ejrJc-0003C8-Qc for 30367@debbugs.gnu.org; Thu, 08 Feb 2018 13:53:03 -0500 Original-Received: (qmail 34656 invoked by uid 3782); 8 Feb 2018 18:52:59 -0000 Original-Received: from acm.muc.de (p548C6A59.dip0.t-ipconnect.de [84.140.106.89]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 08 Feb 2018 19:52:58 +0100 Original-Received: (qmail 4699 invoked by uid 1000); 8 Feb 2018 18:42:32 -0000 Content-Disposition: inline In-Reply-To: <20180208172558.GA4335@ACM> 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:143029 Archived-At: On Thu, Feb 08, 2018 at 17:25:58 +0000, Alan Mackenzie wrote: > Hello, Bastian. [ .... ] > I think I understand what's happening, now. > c-looking-at-or-maybe-in-bracelist attempts to go back over the innards > of a brace list to the enclosing "{". At L+122, in new handling for a > comma, I rather rashly inserted a `c-go-up-list-backward' to test whether > the comma is inside a brace. This was in a loop, once for each sexp. > In your sample file there is, at L10,653 a construct at top level with > _lots_ of commas. My loop is trying to go to the non-existent containing > brace for each of these commas, so ends up scanning to BOB for each of > them. This entire activity will be being done several times. > I timed a single `c-go-up-list-backward' from one of these commas at > 0.033 seconds. 30 of these take about a second, and my machine is > anything but slow. > So, I just need to work out a way of fixing this, which may take some > while (sorry). Actually, that cond arm with the `c-go-up-list-backward' was merely an "optimisation". :-( If I simply remove it, the code goes ~30 times faster, without triggering any successes in the test suite. Would you please try out the following patch on real code, and either confirm to me that it fixes the bug, or tell me what it breaks. Thanks! diff -r e8b2c6141f97 cc-engine.el --- a/cc-engine.el Fri Feb 02 20:34:15 2018 +0000 +++ b/cc-engine.el Thu Feb 08 18:39:40 2018 +0000 @@ -10547,13 +10547,6 @@ (looking-at c-return-key)) (setq braceassignp t) nil) - ((and c-has-compound-literals - (eq (char-after) ?,)) - (save-excursion - (when (and (c-go-up-list-backward nil lim) - (eq (char-after) ?\()) - (setq braceassignp t) - nil))) ((eq (char-after) ?=) ;; We've seen a =, but must check earlier tokens so ;; that it isn't something that should be ignored. [ .... ] > > Cheers > > Bastian -- Alan Mackenzie (Nuremberg, Germany). > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot