unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: jan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Alan Mackenzie <acm@muc.de>, 48871@debbugs.gnu.org
Subject: bug#48871: 27.2; Unusably slow in C# mode
Date: Sun, 6 Jun 2021 19:00:57 +0100	[thread overview]
Message-ID: <CADJx9LfCc-7ZSLi7a67bBkrCHdcDrivC7ukReaeF_D5SQ2LrqA@mail.gmail.com> (raw)
In-Reply-To: <83v96rgc6w.fsf@gnu.org>

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 <eliz@gnu.org> wrote:
>> From: jan <rtm443x@googlemail.com>
>> 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%       - #<compiled 0x1aaa1ff2c62de223>
> 	  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%            #<compiled 0x4f47ef635173>
> 	     1   0%           c-clear-syn-tab
> 	    63   0%     - c-after-change
>





  reply	other threads:[~2021-06-06 18:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 12:32 bug#48871: 27.2; Unusably slow in C# mode jan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-06 12:49 ` Eli Zaretskii
2021-06-06 13:34   ` jan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-06 13:50     ` Eli Zaretskii
2021-06-06 14:53       ` jan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-06 17:00         ` Eli Zaretskii
2021-06-06 18:00           ` jan via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-06-06 18:08             ` Eli Zaretskii
2021-06-06 18:22               ` jan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-06 19:27                 ` Alan Mackenzie
2021-06-09 11:06                   ` jan via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADJx9LfCc-7ZSLi7a67bBkrCHdcDrivC7ukReaeF_D5SQ2LrqA@mail.gmail.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=48871@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=rtm443x@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).