From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Olivier Scalbert Newsgroups: gmane.emacs.bugs Subject: bug#42490: Emacs is very slow when navigating into a specific C++ file Date: Mon, 21 Sep 2020 19:29:28 +0200 Message-ID: <2b34ae1e-c4ee-9176-206d-4ac98708c606@algosyn.com> References: <8E02A060-9CF0-4B1F-A780-4F51336291FA@acm.org> <20200724192450.GA8811@ACM> <1b3a22e8-859f-b839-74cb-1905a8298b52@algosyn.com> <20200921090639.GA6379@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22528"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 42490@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 21 20:20:30 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kKQQP-0005jj-Q9 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Sep 2020 20:20:30 +0200 Original-Received: from localhost ([::1]:57258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKQQO-0003rb-DB for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Sep 2020 14:20:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKQJD-0007NX-0H for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 14:13:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kKQJC-0004AC-Lu for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 14:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kKQJC-0004Ej-G4 for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 14:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Olivier Scalbert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Sep 2020 18:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42490 X-GNU-PR-Package: emacs Original-Received: via spool by 42490-submit@debbugs.gnu.org id=B42490.160071194116223 (code B ref 42490); Mon, 21 Sep 2020 18:13:02 +0000 Original-Received: (at 42490) by debbugs.gnu.org; 21 Sep 2020 18:12:21 +0000 Original-Received: from localhost ([127.0.0.1]:56138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKQIU-0004DY-Qp for submit@debbugs.gnu.org; Mon, 21 Sep 2020 14:12:21 -0400 Original-Received: from maverick.wznoc.com ([67.222.128.248]:50116) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKPdB-0003AT-Vd for 42490@debbugs.gnu.org; Mon, 21 Sep 2020 13:29:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=algosyn.com ; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FbGCvy0fEZeH/hwCiIz/GOkjYvFcaIeLKvuQ2RhQ+3U=; b=j/+FFsp3aZ2dwr4CyPuDgb3hsZ Zo8VLp/JKjtoJAa9AAfPOt9Xut1Nl9BSp0Ftv384ehWNI/USaIAATchiMprnzzbajYahKYDeIXJLB eE3716llmdl0pJXQU3cVPhaKkhtkBKu5+ugIbHjWpPXZfjLnAoZ/Ma3rUg8TOR62dCU524pWjP1NV b5LawFJeaSM9xyHH+wcAdBgQijC0qYpRcnwsApG02D5st788k0gm6O1+3p8uVRnpEsVNhBNkA8sRG NUw6MZ36ap/1oZDhojnTOYVri4fFEnFvPq8Y6QQNP+zu5lXzgxYpY76OzTPxE5jN+NL6aPUS5Jqdn vbg62pTw==; Original-Received: from [109.130.219.96] (port=55674 helo=[192.168.1.59]) by maverick.wznoc.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kKPd5-00088i-A7; Mon, 21 Sep 2020 12:29:31 -0500 In-Reply-To: <20200921090639.GA6379@ACM> Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - maverick.wznoc.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - algosyn.com X-Get-Message-Sender-Via: maverick.wznoc.com: authenticated_id: olivier.scalbert@algosyn.com X-Authenticated-Sender: maverick.wznoc.com: olivier.scalbert@algosyn.com X-Mailman-Approved-At: Mon, 21 Sep 2020 14:12:17 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188632 Archived-At: Hello Alan, Ping reply ! ;-) I was sure I had already answered. Sorry for that. With a fresh compile of Emacs 27.1, it is effectively faster than before. So, for me, you can close the bug. Many thanks ! Regards, Olivier On 9/21/20 11:06 AM, Alan Mackenzie wrote: > Hello, Olivier. > > Ping? > > On Fri, Jul 24, 2020 at 21:34:51 +0200, Olivier Scalbert wrote: >> Hi, >> Thanks for your answer. >> Unfortunately, I am out of my home, with no PC, for the week-end. >> If I'll survive, I will test it next Monday. Very sorry ! >> ;-) > Emacs 27.1 was released just a few weeks ago. Maybe you're already > using it. > > I think CC Mode processes the test file fast enough on 27.1, so it's > probably time to close this bug. What do you say? > >> Regards, >> Olivier > > > > > > >> On 7/24/20 9:24 PM, Alan Mackenzie wrote: >>> Hello, Mattias and Olivier. >>> Firstly Olivier, thanks for taking the trouble to report the bug. >>> On Fri, Jul 24, 2020 at 18:46:45 +0200, Mattias EngdegÄrd wrote: >>>> Hello Olivier, >>>> Thanks for the report! Could you try Emacs 27 (or git master), building >>>> from source if necessary? Those versions should be slightly faster, >>>> although the response time is probably well below acceptable. >>>> If we distill the essentials of your file to some sort of benchmark, we >>>> might end up with: >>>> (with-temp-buffer >>>> (c++-mode) >>>> (dotimes (_ 1000) >>>> (insert "OP(ed,b0) { ldir(); } /* LDIR */\n")) >>>> (garbage-collect) >>>> (let ((t0 (current-time))) >>>> (font-lock-ensure (point-min) (point-max)) >>>> (time-to-seconds (time-since t0)))) >>>> Emacs 26.3 runs it in 11.9 s on this old lappy, but Emacs 27 does it in >>>> 3.3 s. This is a clear improvement but we should be able to do better. >>>> Alan may have a feeling for where the cycles are spent. >>> I've bisected CC Mode to find the critical change, and it is: >>> commit cc80eeb4a43d2079963de3d181002a6a6b56560d >>> Author: Alan Mackenzie >>> Date: Fri Apr 12 20:07:03 2019 +0000 >>> Analyze C++ method with & or && ref-qualifier as defun, not brace list >>> Also firm up detection of beginning of brace list in >>> c-looking-at-or-maybe-in-bracelist. >>> I have a simple benchmark which scrolls through a file, fontifying it, >>> and my results from this benchmark are: >>> (i) Before applying that patch: 53.022s. >>> (ii) After applying that patch: 7.039s. >>> I don't understand at the moment why that patch sped up scrolling in your >>> (Olivier's) file, but it would seem the patch is most desirable. >>> Unfortunately, the patch won't apply cleanly to the Emacs 26.3 sources. >>> It might be possible to find a sequence of patches which would do the >>> job. I think (though I haven't checked) the patch will have been >>> included in the upcoming Emacs 27.1 release.