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: Wed, 7 Feb 2018 16:27:35 +0100 Message-ID: References: <20180207152435.72040.qmail@mail.muc.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c0327ac4da1960564a0ef8c" X-Trace: blaine.gmane.org 1518017278 8197 195.159.176.226 (7 Feb 2018 15:27:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Feb 2018 15:27:58 +0000 (UTC) Cc: 30367@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 07 16:27:53 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 1ejRdV-0001bY-NB for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Feb 2018 16:27:49 +0100 Original-Received: from localhost ([::1]:51793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejRfX-0005ng-33 for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Feb 2018 10:29:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejRdn-0004HK-SC for bug-gnu-emacs@gnu.org; Wed, 07 Feb 2018 10:28:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejRdm-0005Fx-ID for bug-gnu-emacs@gnu.org; Wed, 07 Feb 2018 10:28:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53720) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejRdi-0005EQ-Si; Wed, 07 Feb 2018 10:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ejRdi-0004Be-GC; Wed, 07 Feb 2018 10:28: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: Wed, 07 Feb 2018 15:28: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.151801726416065 (code B ref 30367); Wed, 07 Feb 2018 15:28:02 +0000 Original-Received: (at 30367) by debbugs.gnu.org; 7 Feb 2018 15:27:44 +0000 Original-Received: from localhost ([127.0.0.1]:33384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejRdP-0004B3-Jd for submit@debbugs.gnu.org; Wed, 07 Feb 2018 10:27:44 -0500 Original-Received: from mail-yw0-f171.google.com ([209.85.161.171]:41115) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejRdN-0004Am-KR for 30367@debbugs.gnu.org; Wed, 07 Feb 2018 10:27:42 -0500 Original-Received: by mail-yw0-f171.google.com with SMTP id b129so272672ywa.8 for <30367@debbugs.gnu.org>; Wed, 07 Feb 2018 07:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cHAV2dLagjOmTQvpOIOFoZw+zeJM5QDVfQy4v3P7y5o=; b=NH1bppTsisRRT8+XEypkIl+8yZ7j4YRTieYA1y0Wjr5iC2omiJBVIx4PPVzpM8dqGd N/GFtc1Ef3s3Snc/nIsUPxAjGMJehaV0mCS1wWd7Vy7f43Uy2+RuBCzKCmTXyX5+lPD1 6HEPau6uknuB37Xv/niWapoHZ3UtmLePSwCG4LkWt9btqtFApk6e0xsnge+O80stv3q7 P7SQ/4jmMRbxpg6Dw7hhSE9bnXaxaFjT15sEhIuuoctldH8nZHrMZzPlEgWvdRECdIRz rXFwH0e/4tGUlo0ZIWEk7xCqMNyWe6BvU22DQ87tswb2zlAAghvarHJQ211rqx+Wle3L sIKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cHAV2dLagjOmTQvpOIOFoZw+zeJM5QDVfQy4v3P7y5o=; b=DkKv+pfXM6/1uO49sYjFQ3NakwLyRJ6uDFgPQiTrCRqJOGIVdtnoiW5Dvq9msW5FHH M5HhXfWG2h+VF7LEZ9h+vUZz4p3Qm3lirx28TOTiLwF97BzIjIw5O82ygvUMyViwekVv L2RR2dx06LDQ/GfpvQ3AqIfdJbLjvyuaXVD+UinSLqAeZT3BJNmFUSDXU8XpiN0H24IO sMEe7lGOcptdXBcM3cpcFUtY7q02232IunnwT32TTo6ZvH6ArTwXU5y+0JaaPJ6uTFM4 D2L6X+9FMoAZEz8xy3woGQs2cWJDrQCDV+DGNrT/P17dDp5hx9igPthPClPjBO6M4YLf WrAQ== X-Gm-Message-State: APf1xPD2+Z4KX6ScFtX4aPxSO/zLSJFruPjUMI0Di31EdbtgOnQNZP/N wS7x0cqx9F3Pu0xz2Q2Pvx5BW9KiSsSEnDYEcqkOVw== X-Google-Smtp-Source: AH8x224pZLN4CC+G6PNDQ8ST6SLU3TnL7RWg6uZZqifd6/CNg5ev3UQqK6sQwIHsfBUUcUStYTrAvCk1v8l8jZXls3E= X-Received: by 10.13.240.1 with SMTP id z1mr4106430ywe.209.1518017255938; Wed, 07 Feb 2018 07:27:35 -0800 (PST) Original-Received: by 10.129.93.69 with HTTP; Wed, 7 Feb 2018 07:27:35 -0800 (PST) In-Reply-To: <20180207152435.72040.qmail@mail.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:143007 Archived-At: --94eb2c0327ac4da1960564a0ef8c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Alan, On Wed, Feb 7, 2018 at 4:24 PM, Alan Mackenzie wrote: > Hello, Bastian. > > In article you > wrote: > > > After updating CC-Mode to the latest version in the standalone mercuria= l > > 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. > Sure, but =E2=80=8BI will send you the file off-list, since I don't want it= to become public. =E2=80=8B > > > 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 list= s. > > > > * 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 va= r. > > > > * 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. > =E2=80=8BSorry, I didn't know that and will do it next time! =E2=80=8B > > > > In GNU Emacs 26.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.2= 6) > > 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). > =E2=80=8BCheers Bastian --94eb2c0327ac4da1960564a0ef8c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Alan,

On Wed, Feb 7, 2018 at 4:24 PM, Alan Mackenzie <acm@muc.de> wrote:
Hello, Bastian.

In article <
mailman.8662.1517913372.27995.bug-gnu-emacs@gnu.org>= you wrote:

> After updating CC-Mode to the latest version in the standalone mercuri= al
> 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?=C2=A0 Any chance you could supply me with such a sample=
C++ file that is slow on searching.=C2=A0 Then, in case something else
besides the size is slowing it down, I'll have a "working" fi= le to
diagnose the bug with.

Sure, but =E2=80= =8BI will send you the file off-list, s= ince I don't want it to become public.
=E2=80=8B

> I traced the problem back to this commit:

> Author: Alan Mackenzie <bug-= cc-mode@gnu.org>
> Date:=C2=A0 =C2=A0Sun Jan 21 18:05:41 2018 +0000

>=C2=A0 =C2=A0 =C2=A0Handle C99 Compound Literals in return statements a= nd argument lists.
>
>=C2=A0 =C2=A0 =C2=A0* cc-engine.el (c-looking-at-or-maybe-in-brace= list): Recognize a brace list
>=C2=A0 =C2=A0 =C2=A0when preceded by "return" or inside paren= theses, either immediately after the
>=C2=A0 =C2=A0 =C2=A0"(" or following a comma.
>=C2=A0 =C2=A0 =C2=A0(c-looking-at-inexpr-block): Test c-has-compound-li= terals rather than hard
>=C2=A0 =C2=A0 =C2=A0coded C++ Mode.
>=C2=A0 =C2=A0 =C2=A0(c-guess-basic-syntax, CASE 7B): Test additionally = for not being just inside a
>=C2=A0 =C2=A0 =C2=A0parenthesis or being at a Java "new" keyw= ord.=C2=A0 CASE 9: Remove the simple
>=C2=A0 =C2=A0 =C2=A0minded test on the contents of a block to determine= a brace list.
>
>=C2=A0 =C2=A0 =C2=A0* cc-langs.el (c-has-compound-literals): New lang c= onst and lang var.
>
>=C2=A0 =C2=A0 =C2=A0* bracelist-30.{c,res}: New test files.

Thanks for getting this information.=C2=A0 This should help track down the<= br> problem.

> I am attaching the result of a run of the emacs profiler before
> ("fast.profile") and after the commit ("slow.profile&qu= ot;). 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&#= 39;
> 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.=C2=A0 Somet= imes a CC Mode dump produced by C-c C-b can
be useful, though I don't think it would help much here.

=E2=80=8BSorry, I didn't know that and will do it n= ext time!
=E2=80=8B


> In GNU Emacs 26.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.= 26)
>=C2=A0 of 2018-02-06 built on beischer-w520
> Repository revision: c787a4968273027960a20ced6d63bae0d1ffa87e
> Windowing system distributor 'The X.Org Foundation', version 1= 1.0.11906000

[ .... ]

--
Alan Mackenzie (Nuremberg, Germany).
=E2=80=8BCheers
Bastian
--94eb2c0327ac4da1960564a0ef8c--