From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#48871: 27.2; Unusably slow in C# mode Date: Sun, 6 Jun 2021 19:00:57 +0100 Message-ID: References: <835yyri2f2.fsf@gnu.org> <83y2bngl0b.fsf@gnu.org> <83v96rgc6w.fsf@gnu.org> Reply-To: jan Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10030"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alan Mackenzie , 48871@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 06 20:02:10 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 1lpx6A-0002OG-Hp for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 20:02:10 +0200 Original-Received: from localhost ([::1]:54266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpx69-0004eR-Hv for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Jun 2021 14:02:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpx62-0004ck-PQ for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 14:02:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpx62-00016u-Hs for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 14:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lpx62-0001Zg-FX for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2021 14:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: jan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jun 2021 18:02:02 +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.16230024695977 (code B ref 48871); Sun, 06 Jun 2021 18:02:02 +0000 Original-Received: (at 48871) by debbugs.gnu.org; 6 Jun 2021 18:01:09 +0000 Original-Received: from localhost ([127.0.0.1]:53846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpx5B-0001YK-8r for submit@debbugs.gnu.org; Sun, 06 Jun 2021 14:01:09 -0400 Original-Received: from mail-pl1-f180.google.com ([209.85.214.180]:45792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpx55-0001Xd-LK for 48871@debbugs.gnu.org; Sun, 06 Jun 2021 14:01:07 -0400 Original-Received: by mail-pl1-f180.google.com with SMTP id 11so7357334plk.12 for <48871@debbugs.gnu.org>; Sun, 06 Jun 2021 11:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=08PBCRVYtq58kIrSPB4FpZgH2hN+aNGLbKkuZQyH5bo=; b=leD4kR99nF9B4wou4SpuLY78TuaZA9dBqMQvwwG+Jf4DifLuDwd3PK1Qt9USEcAR7t rnp/221YwqQAP+hoY1qznsSJ5S88xNmlcz4h0B10wEgGrz3rXJmavbmzJHchpFlAtM7v 4uh4pt2ylX7fU51BmQ0GrsqsQrhhfk4WPJgsEkwH/wBvclpuVNrb+WzsDJ9IfmUwkTpQ m4BzO4JBzADjPFNssMk4t+XEjWe4j4XgdGRX3S5sdqwIUpJ5lJtFebeZA5vTBn7HyurO S1JRTsywbnBoMVt25IdtpRcD+wZyKK5dJUsSzWekpcFYHFNnb46Z8RHkkk5nWQ+sYYQ+ Ndew== 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=08PBCRVYtq58kIrSPB4FpZgH2hN+aNGLbKkuZQyH5bo=; b=k1tL6Ap3RuGWy5f6I1Vi+SklCWrc7U/uDkE5WO7pYBvJelM1fEkIGtim5OUqIeId9T MfS2MjeYDMKKcle4UIkvE+25Id6FRBnmN0BqB9H3UVIzo8hQLRmSwvo2eU1yxIIvxuSu uj1182d+TRwdDs/JPaQ8zvLoowQnQck3OnYMvOEvifuEtXqF1o0+mFWtKwzgtDEoDO49 reLnKZ9573mPqJWS7xyUvF+d5eyXywTon34Uab91IKfwhB+DmpZxcuqCT/zEDb3vfSXa IPzolcEdR3YdqCyrju07gbeCJwdlwAleGSyb+wV6+0AKBrT65XHpV4NXlX4zCZLQaW5G vs8g== X-Gm-Message-State: AOAM531CHTLx8AxuClG46N0GxZM2PmM0BofuQ4OPp43JD3A/Rv1H0+cg INaL2xA0lXpz2bXAfT8RI6+C1ooh1pJb21kmxRo= X-Google-Smtp-Source: ABdhPJyU+VX+9IadV+0k10AzBObFsfDQBiaU7P1rfhQWL8ti9p7pEmStOWzeq1pHTu6LSog71mLvaJcyh7sUkWlA9Es= X-Received: by 2002:a17:90b:f84:: with SMTP id ft4mr29000703pjb.104.1623002457528; Sun, 06 Jun 2021 11:00:57 -0700 (PDT) Original-Received: by 2002:a17:90a:aa06:0:0:0:0 with HTTP; Sun, 6 Jun 2021 11:00:57 -0700 (PDT) In-Reply-To: <83v96rgc6w.fsf@gnu.org> 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:208144 Archived-At: Looks like strings doing it. Go to fundamental mode (or search&replace will take forever), completely remove all strings with regex replace: ".*?" -> Save file then close and reopen emacs, reopen file, ensure it's in csharp mode, char insertion is almost back to normal. That is, remove strings entirely. Just replacing them with empty strings "" didn't help. cheers jan On 06/06/2021, Eli Zaretskii wrote: >> 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 >