From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bastian Beischer Newsgroups: gmane.emacs.bugs Subject: bug#30367: 26.0.91; CC-Mode: Major slowdown when isearching big C++ file. Date: Fri, 09 Feb 2018 10:16:53 +0100 Message-ID: <87372a8quy.fsf@gmail.com> References: <20180207152435.72040.qmail@mail.muc.de> <20180207212145.GA3963@ACM> <20180207222638.GB3963@ACM> <20180208172558.GA4335@ACM> <20180208184232.GB4335@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1518167797 10674 195.159.176.226 (9 Feb 2018 09:16:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 9 Feb 2018 09:16:37 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) Cc: 30367@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 09 10:16:33 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 1ek4n4-0001Zc-2E for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Feb 2018 10:16:18 +0100 Original-Received: from localhost ([::1]:52188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4p5-0006HG-HT for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Feb 2018 04:18:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4ou-0006FQ-Eb for bug-gnu-emacs@gnu.org; Fri, 09 Feb 2018 04:18:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4oo-0006VK-KE for bug-gnu-emacs@gnu.org; Fri, 09 Feb 2018 04:18:12 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54970) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ek4ok-0006Pl-IU; Fri, 09 Feb 2018 04:18:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ek4ok-0007Hq-78; Fri, 09 Feb 2018 04:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Bastian Beischer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Fri, 09 Feb 2018 09:18: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.151816782927952 (code B ref 30367); Fri, 09 Feb 2018 09:18:02 +0000 Original-Received: (at 30367) by debbugs.gnu.org; 9 Feb 2018 09:17:09 +0000 Original-Received: from localhost ([127.0.0.1]:34634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ek4nt-0007Gm-KP for submit@debbugs.gnu.org; Fri, 09 Feb 2018 04:17:09 -0500 Original-Received: from mail-wr0-f171.google.com ([209.85.128.171]:43153) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ek4nq-0007GC-KZ for 30367@debbugs.gnu.org; Fri, 09 Feb 2018 04:17:07 -0500 Original-Received: by mail-wr0-f171.google.com with SMTP id b52so7448660wrd.10 for <30367@debbugs.gnu.org>; Fri, 09 Feb 2018 01:17:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=pi9NJOfRmbKKNlbBKF0ISqV1RXKtiJB0hOU+IoMecno=; b=Sopj7AgActx+N2KvEYmZ5+Bv3ZwoE+0EHsbo5HOfbvfU9Sqyz96igvLJorj9abAKZr NhjR9hvNaSL9HEOAF/HwncKp+9i6GELfVL7sdJ/K8iPVD0zOowq/wzxwQsTgQsz3yGji Yex6J9QX0E9c52hHwfgkZZWFqNnVzyMwc9yuGfSWd2Df5fj7eFHBpq4fuaODEceo42/w 6bSsXzZJKTxEyr2fDRewZO5i2maJgs9/XkXR+OLRcCxFe8yObxucDNKBYtBJkL9E2aoK jeEdvi8TnaA1FMfBWnzuNsXNnx1HiEQ2+XnfsnZ3Ytm7oujAHETu1Ty/JEUtvsQjRfha bKjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=pi9NJOfRmbKKNlbBKF0ISqV1RXKtiJB0hOU+IoMecno=; b=V4zpnfy/d7B7sgj7vqWtaig5KJeVDaYxza6CKq5pNXTjDfgRaMtppTnayyfmhsYZDo kaygfGU8l/MmMNaEalgGpKe5Qr/kb47jAniLm0nI42Q4oSA7dQr+MO7klv6Eq0JRoIRu 275qPORQmZX514A+luYOQwniS5DkVxSF1jV6DziWKqMYF9lBgVxtYHLYYdtzh9AiJlEd X0AXu6Hx3eenjDSD4J+1IKdJCNJcQj0SG8b9Rg+OEnzEIRz0QqZnbsJ5jJnwPs4WSNVp 2SCRvVZhrb9FdU+3lR0B0tl/ugyfV91/8NuBbck2+VF5ZFSi3O5qf0Rc1Q0pwbKtV+Hj YnCA== X-Gm-Message-State: APf1xPAdcuNJROBF0Q7zAkgjesTdNklKHnur40WYE/uOcTN5uablcOqS ZuHcmiezGSJ/5BqcJI9xKKZQOQ== X-Google-Smtp-Source: AH8x224lQMEBlcn4GA+aqivwboTn3mJF9bbOjwz0jpn4WWLVOuu+L68VUJWmA/Lr0RHknn+UfoMG6g== X-Received: by 10.223.184.28 with SMTP id h28mr1685029wrf.215.1518167820465; Fri, 09 Feb 2018 01:17:00 -0800 (PST) Original-Received: from beischer-w520.gmail.com (priv-1b-5-156.physik.rwth-aachen.de. [134.61.5.156]) by smtp.gmail.com with ESMTPSA id 137sm1692841wmm.46.2018.02.09.01.16.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Feb 2018 01:16:59 -0800 (PST) In-Reply-To: <20180208184232.GB4335@ACM> (Alan Mackenzie's message of "Thu, 8 Feb 2018 18:42:32 +0000") 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:143046 Archived-At: Hello Alan, Alan Mackenzie writes: > 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. > > > > [ .... ] > Yes, this patch fixes the slowdown. But since I don't understand what the original commit which introduced the slowdown tried to fix I cannot comment on whether or not its the right thing to do within the context of that commit. I will run emacs with the patch included for a while and will let you know in case I find any problems! Thanks for tackling this so quickly! >> > Cheers >> > Bastian