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: 7 Feb 2018 15:24:35 -0000 Organization: muc.de e.V. Message-ID: <20180207152435.72040.qmail__17037.1282998987$1518017018$gmane$org@mail.muc.de> References: <87lgg6ieyk.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1518017018 15156 195.159.176.226 (7 Feb 2018 15:23:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Feb 2018 15:23:38 +0000 (UTC) User-Agent: tin/2.4.1-20161224 ("Daill") (UNIX) (FreeBSD/11.1-RELEASE-p4 (amd64)) Cc: 30367@debbugs.gnu.org To: Bastian Beischer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 07 16:23: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 1ejRZ7-0002kS-BD for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Feb 2018 16:23:17 +0100 Original-Received: from localhost ([::1]:51392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejRb8-0001dj-PF for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Feb 2018 10:25:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejRav-0001Ua-Cj for bug-gnu-emacs@gnu.org; Wed, 07 Feb 2018 10:25:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejRau-0003sI-74 for bug-gnu-emacs@gnu.org; Wed, 07 Feb 2018 10:25:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53715) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejRao-0003jH-EQ; Wed, 07 Feb 2018 10:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ejRao-00046v-35; Wed, 07 Feb 2018 10:25: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: Wed, 07 Feb 2018 15:25: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.151801707915764 (code B ref 30367); Wed, 07 Feb 2018 15:25:02 +0000 Original-Received: (at 30367) by debbugs.gnu.org; 7 Feb 2018 15:24:39 +0000 Original-Received: from localhost ([127.0.0.1]:33379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejRaQ-00046B-KY for submit@debbugs.gnu.org; Wed, 07 Feb 2018 10:24:39 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:64526 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1ejRaO-000460-PC for 30367@debbugs.gnu.org; Wed, 07 Feb 2018 10:24:37 -0500 Original-Received: (qmail 72041 invoked by uid 3782); 7 Feb 2018 15:24:35 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug 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:143006 Archived-At: Hello, Bastian. In article you wrote: > After updating CC-Mode to the latest version in the standalone mercurial > repository I noticed that searching large C++ files has become a lot > slower than before (factor 20 or so). Thanks for taking the trouble to report this bug. How large is large? Any chance you could supply me with such a sample C++ file that is slow on searching. Then, in case something else besides the size is slowing it down, I'll have a "working" file to diagnose the bug with. > I traced the problem back to this commit: > Author: Alan Mackenzie > Date: Sun Jan 21 18:05:41 2018 +0000 > Handle C99 Compound Literals in return statements and argument lists. > > * cc-engine.el (c-looking-at-or-maybe-in-bracelist): Recognize a brace list > when preceded by "return" or inside parentheses, either immediately after the > "(" or following a comma. > (c-looking-at-inexpr-block): Test c-has-compound-literals rather than hard > coded C++ Mode. > (c-guess-basic-syntax, CASE 7B): Test additionally for not being just inside a > parenthesis or being at a Java "new" keyword. CASE 9: Remove the simple > minded test on the contents of a block to determine a brace list. > > * cc-langs.el (c-has-compound-literals): New lang const and lang var. > > * bracelist-30.{c,res}: New test files. Thanks for getting this information. This should help track down the problem. > I am attaching the result of a run of the emacs profiler before > ("fast.profile") and after the commit ("slow.profile"). In this run I > started emacs as: > emacs -Q /path/to/big/file.C -e "(add-to-list 'load-path ~/cc-mode)" -e "(require 'cc-mode)" > M-x profiler-start > C-s searchString > M-x profiler-report > And write the result to 'slow.profile' and 'fast.profile' > respectively. It appears that 93% of the time is spent in > c-looking-at-or-maybe-in-bracelist. > Thanks for looking into this issue! Just as a matter of interest, you can post CC Mode bugs direct to bug-cc-mode@gnu.org. Sometimes a CC Mode dump produced by C-c C-b can be useful, though I don't think it would help much here. > In GNU Emacs 26.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.26) > of 2018-02-06 built on beischer-w520 > Repository revision: c787a4968273027960a20ced6d63bae0d1ffa87e > Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 [ .... ] -- Alan Mackenzie (Nuremberg, Germany).