bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48871: 27.2; Unusably slow in C# mode


From: jan
Subject: bug#48871: 27.2; Unusably slow in C# mode
Date: Sun, 6 Jun 2021 13:32:09 +0100

Hi,
I use emacs, I'm not an expert.
C# mode is slow beyond to the point of being completely unusable. This
seems to have started when I upgraded from emacs 26 to emacs 27.2. The
file is ~220K. At the start of the file, typing takes 3 or 4 secs *per
character* to appear (at the end of the file, instantaneous). It's
forcing me to use visual studio to do all simple text editing and I
don't like that.

If I turn off font lock mode it doesn't improve any.
If I switch to fundamental  mode it's back to it's snappy self.
Turning off Syntactic Indentation and Electric Mode didn't help.
I tried removing all comments to see what happened but no luck.

I did find this quite recent issue
<https://github.com/emacs-csharp/csharp-mode/issues/200> but their
solution 
<https://github.com/emacs-csharp/csharp-mode/issues/200#issuecomment-739926801>
didn't help because I couldn't find that text in the specified lisp
file so couldn't comment it out.

I looked on the emacs bug list but found nothing matching (not sure I
was doing the search right though).

I can provide the c# file but I'd prefer it to not be made public if possible.

Turns out emacs has a profiler, thought I'd try it. From
<https://www.gnu.org/software/emacs/manual
/html_node/elisp/Profiling.html> did profiler-start, typed some chars
(probably 20 to 30 secs locked up before it was finished, immediately
did profiler-stop, report is this (heavier parts expanded)

- command-execute                                                1121  97%
 - call-interactively                                            1121  97%
  - funcall-interactively                                        1114  96%
   - self-insert-command                                          889  77%
    - c-before-change                                             878  76%
     - mapc                                                       878  76%
      - #<compiled 0x2297aaf>                                     878  76%
       - c-before-change-check-unbalanced-strings                 877  76%
          c-pps-to-string-delim                                   865  75%
        - c-syntactic-re-search-forward                            11   0%
           c-beginning-of-macro                                     4   0%
    - c-after-change                                               11   0%
     - mapc                                                        11   0%
      - #<compiled 0x2297b19>                                      11   0%
         c-after-change-mark-abnormal-strings                       4   0%
       - c-restore-<>-properties                                    4   0%
          c-syntactic-re-search-forward                             3   0%
        - c-forward-<>-arglist                                      1   0%
         - c-forward-<>-arglist-recur                               1   0%
            c-forward-sws                                           1   0%
       - c-change-expand-fl-region                                  2   0%
        - c-fl-decl-end                                             2   0%
         - c-literal-start                                          2   0%
          - c-semi-pp-to-literal                                    2   0%
             c-parse-ps-state-below                                 2   0%
         c-parse-quotes-after-change                                1   0%
   - newline                                                      223  19%
    - self-insert-command                                         223  19%
     - electric-indent-post-self-insert-function                  112   9%
      - indent-according-to-mode                                  112   9%
       - c-indent-line                                            112   9%
        - c-shift-line-indentation                                112   9%
         - c-before-change                                        110   9%
          + mapc                                                  109   9%
            c-restore-string-fences                                 1   0%
         - c-after-change                                           2   0%
          - mapc                                                    2   0%
           - #<compiled 0x2297b19>                                  2   0%
              c-after-change-mark-abnormal-strings                  1   0%
            - c-restore-<>-properties                               1   0%
               c-syntactic-re-search-forward                        1   0%
     - c-before-change                                            110   9%
      - mapc                                                      110   9%
       - #<compiled 0x2297aaf>                                    110   9%
        - c-before-change-check-unbalanced-strings                110   9%
           c-pps-to-string-delim                                  109   9%
           c-syntactic-re-search-forward                            1   0%
     - c-after-change                                               1   0%
      - mapc                                                        1   0%
       - #<compiled 0x2297b19>                                      1   0%
        - c-restore-<>-properties                                   1   0%
           c-syntactic-re-search-forward                            1   0%
   - execute-extended-command                                       2   0%
    - sit-for                                                       2   0%
       redisplay                                                    2   0%
  + byte-code                                                       7   0%
- ...                                                              25   2%
   Automatic GC                                                    25   2%
+ redisplay_internal (C function)                                   5   0%

Not sure what to do.

cheers

jan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]