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: Fri, 24 Jul 2020 21:34:51 +0200 Message-ID: <1b3a22e8-859f-b839-74cb-1905a8298b52@algosyn.com> References: <8E02A060-9CF0-4B1F-A780-4F51336291FA@acm.org> <20200724192450.GA8811@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="24530"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: 42490@debbugs.gnu.org To: Alan Mackenzie , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 25 00:31:45 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 1jz6EC-0006HQ-U4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Jul 2020 00:31:45 +0200 Original-Received: from localhost ([::1]:52724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jz6EC-0002rI-12 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Jul 2020 18:31:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jz6Cb-0002Ca-74 for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2020 18:30:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jz6CZ-0001Rm-FO for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2020 18:30:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jz6CZ-0000g5-Bs for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2020 18:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Olivier Scalbert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jul 2020 22:30:03 +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.15956297882539 (code B ref 42490); Fri, 24 Jul 2020 22:30:03 +0000 Original-Received: (at 42490) by debbugs.gnu.org; 24 Jul 2020 22:29:48 +0000 Original-Received: from localhost ([127.0.0.1]:48880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jz6CJ-0000er-EP for submit@debbugs.gnu.org; Fri, 24 Jul 2020 18:29:48 -0400 Original-Received: from maverick.wznoc.com ([67.222.128.248]:36606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jz3TB-0004qY-GE for 42490@debbugs.gnu.org; Fri, 24 Jul 2020 15:35:02 -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=k4OrHUC2ElfEiYop/zJAfjRJqH9+UihO6EiqA88MLr4=; b=BSnQfNpj3dXTry+QMPUwLc21h3 2uQ8790aeXZboBOKZDcn1zjvbwblFEEWNFowaJp630uUetqmz++BbK1gfG2LZzA5hAGrAJsge7WPz m6JkbU2EZp8QFRcCTqmExtfVcx4hwnuZbZiL7dOFyOXJ0lK7z6PSEh+VeyKGGQlwrav+ndXjPV0g8 s7HNjsyeyo5HwYOGws01K+eP3YOAa4agp/FU3NXJQI+IFnNGakz1iBHa4eK2gGXrr2MK21lhaBxWr r0O87FTyoiMYCVfiO/vTEAZ/cZIEBNNbW3NhlxGXnt7WQmGErebYO4aM6GBFUpTzRQ1BWo2rT/yjU j2hnoDHw==; Original-Received: from [109.130.219.96] (port=47538 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 1jz3T4-0000EF-Sp; Fri, 24 Jul 2020 14:34:55 -0500 In-Reply-To: <20200724192450.GA8811@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: Fri, 24 Jul 2020 18:29:46 -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:183509 Archived-At: 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 ! ;-) 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. >