From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48871: 27.2; Unusably slow in C# mode Date: Sun, 06 Jun 2021 20:00:55 +0300 Message-ID: <83v96rgc6w.fsf@gnu.org> References: <835yyri2f2.fsf@gnu.org> <83y2bngl0b.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4613"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48871@debbugs.gnu.org To: jan , Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 06 19:02:24 2021 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 1lpwAK-0000yL-LA for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 19:02:24 +0200 Original-Received: from localhost ([::1]:57520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpwAJ-0000cE-0l for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 13:02:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpw9z-0000bq-1z for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 13:02:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpw9y-0007iM-Q9 for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 13:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lpw9x-0008Sq-Us for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 13:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jun 2021 17:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48871 X-GNU-PR-Package: emacs Original-Received: via spool by 48871-submit@debbugs.gnu.org id=B48871.162299886632453 (code B ref 48871); Sun, 06 Jun 2021 17:02:01 +0000 Original-Received: (at 48871) by debbugs.gnu.org; 6 Jun 2021 17:01:06 +0000 Original-Received: from localhost ([127.0.0.1]:53800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpw93-0008RN-Lp for submit@debbugs.gnu.org; Sun, 06 Jun 2021 13:01:05 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpw91-0008Qk-Q2 for 48871@debbugs.gnu.org; Sun, 06 Jun 2021 13:01:04 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54390) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpw8w-0007Hl-Do; Sun, 06 Jun 2021 13:00:58 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1515 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpw8v-00015K-UR; Sun, 06 Jun 2021 13:00:58 -0400 In-Reply-To: (message from jan on Sun, 6 Jun 2021 15:53:11 +0100) 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:208140 Archived-At: > From: jan > Date: Sun, 6 Jun 2021 15:53:11 +0100 > Cc: 48871@debbugs.gnu.org > > I don't recall installing c# but may well have happened. > >From package-list-packages: > > csharp-mode 20210328.2004 installed C# mode derived mode > > Which does not say built-in so likely I did. Looking in the unzipped > emacs 27.2 , no relevant *sharp* file in it, and did find it in the > elpa directory, so I guess must have. > > Started with -Q. Did the M-x load-file for csharp-mode.el (FYI also > had to do load-file for csharp-compilation.el before that to make it > happy). > > Finally got to load the C# file itself, exactly the same. No faster. > > Troublesome C# file attached. Thanks. Alan, can you look into this? It could be some problem in csharp-mode, but the profiler says 97% of the time is spent in a CC mode code, so maybe you can shed some light on this? I see that almost the entire 6896-line file is enclosed in a single "namespace LDB { ... }" block, maybe this is the reason? Here's the main portion of a profile measured on my system from just inserting 3 characters at BOB of the file attached by the OP. An unoptimized build of Emacs 28 took about 2 min(!) to process those 3 self-inserting characters. 8693 98% - command-execute 8693 98% - call-interactively 8693 98% - funcall-interactively 8690 98% - self-insert-command 8627 98% - c-before-change 8627 98% - mapc 8627 98% - # 8627 98% - c-before-change-check-unbalanced-strings 8611 97% c-pps-to-string-delim 10 0% - c-syntactic-re-search-forward 2 0% - c-beginning-of-macro 2 0% back-to-indentation 1 0% # 1 0% c-clear-syn-tab 63 0% - c-after-change