unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: acm@muc.de, 10149@debbugs.gnu.org, fatkasuvayu+linux@gmail.com
Subject: bug#10149: Emacs 24 hangs for several minutes with very large c++ files
Date: Sat, 02 Nov 2019 09:31:47 +0200	[thread overview]
Message-ID: <83r22qka3g.fsf@gnu.org> (raw)
In-Reply-To: <878sozw5nf.fsf@marxist.se> (message from Stefan Kangas on Sat, 02 Nov 2019 00:14:44 +0100)

> From: Stefan Kangas <stefan@marxist.se>
> Date: Sat, 02 Nov 2019 00:14:44 +0100
> Cc: Alan Mackenzie <acm@muc.de>, 10149@debbugs.gnu.org
> 
> > [1] The large chunk of commented text in the attached file
> 
> I do see a significant slowdown in navigating the file once I comment
> out the block of code.  It doesn't hang for several minutes for me,
> but it takes 5-10 seconds for C-v, M-v depending on where point is.
> 
> Alan, any comments on this?

The OP doesn't make it clear, and it took me some seconds to realize,
that to see the problem, one needs to _un_comment the commented chunk.

Here's the profile for paging through that part with C-v.  As is
clearly visible, the culprit is c-font-lock-single-decl.

- command-execute                                                9167  72%
 - call-interactively                                            9167  72%
  - funcall-interactively                                        9164  72%
   - scroll-up-command                                           9162  72%
    - scroll-up                                                  9125  71%
     - jit-lock-function                                         9124  71%
      - jit-lock-fontify-now                                     9124  71%
       - jit-lock--run-functions                                 9123  71%
        - run-hook-wrapped                                       9123  71%
         - #<compiled -0x1ffffffff85fe718>                       9123  71%
          - font-lock-fontify-region                             9123  71%
           - c-font-lock-fontify-region                          9123  71%
            - font-lock-default-fontify-region                   9014  71%
             - font-lock-fontify-keywords-region                 9003  70%
              - c-font-lock-declarations                         8645  68%
               - c-find-decl-spots                               8640  68%
                - #<compiled -0x1ffffffff9680598>                8579  67%
                 - c-font-lock-single-decl                       8453  66%
                  - c-font-lock-declarators                        39   0%
                   - c-do-declarators                              38   0%
                    - c-forward-declarator                         30   0%
                     - c-syntactic-re-search-forward                 14   0%
                        c-beginning-of-macro                        8   0%
                     - c-forward-name                               3   0%
                        c-forward-sws                               1   0%
                     - c-backward-sws                               1   0%
                        c-beginning-of-current-token                  1   0%
                      #<compiled -0x1ffffffff9680fb0>                  2   0%
                      c-forward-sws                                 1   0%
                    c-backward-sws                                  1   0%
                    c-fontify-recorded-types-and-refs                  1   0%
                 - c-forward-decl-or-cast-1                        98   0%
                  - c-forward-type                                 62   0%
                   - c-forward-name                                21   0%
                      c-forward-sws                                 7   0%
                   - c-check-qualified-type                        10   0%
                    - c-forward-over-compound-identifier                  8   0%
                     - c-forward-over-token                         6   0%
                        c-forward-sws                               3   0%
                       c-forward-sws                                1   0%
                       c-on-identifier                              1   0%
                   - c-add-type                                     4   0%
                    - c-syntactic-content                           4   0%
                       c-forward-sws                                2   0%
                     c-forward-keyword-clause                       2   0%
                     #<compiled -0x1ffffffff9736820>                  1   0%
                     #<compiled -0x1ffffffff8c38b48>                  1   0%
                     c-forward-sws                                  1   0%
                  - c-forward-name                                  6   0%
                     c-forward-sws                                  1   0%
                  - c-backward-token-2                              4   0%
                     c-backward-sws                                 3   0%
                     c-beginning-of-current-token                   1   0%
                  - c-backward-sws                                  3   0%
                     c-beginning-of-current-token                   2   0%
                    c-forward-sws                                   1   0%
                 - c-backward-sws                                  10   0%
                  - c-beginning-of-macro                            8   0%
                     back-to-indentation                            3   0%
                 - c-backward-token-2                               2   0%
                    c-backward-sws                                  2   0%
                - c-bs-at-toplevel-p                               42   0%
                 - c-brace-stack-at                                39   0%
                  - c-update-brace-stack                           39   0%
                     c-syntactic-re-search-forward                 38   0%
                  c-beginning-of-macro                              7   0%
                  c-forward-sws                                     4   0%
                c-font-lock-<>-arglists                            87   0%
              - c-font-lock-cut-off-declarators                    68   0%
               - c-back-over-member-initializers                   46   0%
                - c-parse-state                                    44   0%
                 - c-parse-state-1                                 44   0%
                  - c-append-to-state-cache                        28   0%
                   - c-beginning-of-macro                           1   0%
                      back-to-indentation                           1   0%
                  - c-remove-stale-state-cache                     16   0%
                   - c-beginning-of-macro                           1   0%
                      #<compiled -0x1ffffffff8c48290>                  1   0%
                  c-backward-sws                                    1   0%
               - c-determine-limit                                 20   0%
                - c-semi-pp-to-literal                             11   0%
                   c-restore-string-fences                          1   0%
               - c-syntactic-skip-backward                          1   0%
                - c-beginning-of-macro                              1   0%
                   back-to-indentation                              1   0%
              - c-font-lock-complex-decl-prepare                   61   0%
               - c-parse-state                                     59   0%
                - c-parse-state-1                                  59   0%
                   c-append-to-state-cache                         31   0%
                 - c-remove-stale-state-cache-backwards                 18   0%
                  - c-state-literal-at                              4   0%
                     c-state-pp-to-literal                          3   0%
                   - c-state-safe-place                             1   0%
                      c-state-pp-to-literal                         1   0%
                    c-state-balance-parens-backwards                  1   0%
                   c-remove-stale-state-cache                       9   0%
                 c-backward-sws                                     1   0%
               - c-beginning-of-macro                               1   0%
                  back-to-indentation                               1   0%
              - c-font-lock-enclosing-decls                        45   0%
               - c-parse-state                                     35   0%
                - c-parse-state-1                                  33   0%
                   c-append-to-state-cache                         22   0%
                   c-remove-stale-state-cache                      11   0%
                - c-beginning-of-macro                              1   0%
                   back-to-indentation                              1   0%
                 c-determine-limit                                  9   0%
               - c-syntactic-skip-backward                          1   0%
                  c-beginning-of-macro                              1   0%
              - c-font-lock-enum-tail                              35   0%
               - c-parse-state                                     23   0%
                - c-parse-state-1                                  22   0%
                   c-append-to-state-cache                         15   0%
                   c-remove-stale-state-cache                       6   0%
                - c-beginning-of-macro                              1   0%
                   back-to-indentation                              1   0%
               - c-backward-over-enum-header                       12   0%
                - c-backward-typed-enum-colon                       6   0%
                 - c-backward-token-2                               6   0%
                  - c-backward-sws                                  1   0%
                     c-beginning-of-current-token                   1   0%
                - c-backward-token-2                                4   0%
                 - c-backward-sws                                   3   0%
                  - c-beginning-of-macro                            2   0%
                     back-to-indentation                            2   0%
                    c-beginning-of-current-token                    1   0%
                  c-on-identifier                                   1   0%
              - #<compiled -0x1ffffffff8d285c8>                    31   0%
               - c-beginning-of-decl-1                             18   0%
                - c-beginning-of-statement-1                       16   0%
                 - c-crosses-statement-barrier-p                    7   0%
                    c-forward-sws                                   3   0%
                    c-literal-limits                                1   0%
                 - c-backward-sws                                   5   0%
                  - c-beginning-of-macro                            1   0%
                     back-to-indentation                            1   0%
                   c-beginning-of-macro                             1   0%
                - c-syntactic-re-search-forward                     1   0%
                   c-beginning-of-macro                             1   0%
               - c-determine-limit                                 11   0%
                - c-backward-sws                                    2   0%
                   c-beginning-of-macro                             1   0%
                - c-semi-pp-to-literal                              1   0%
                   c-semi-get-near-cache-entry                      1   0%
              - c-font-lock-raw-strings                             4   0%
               - c-semi-pp-to-literal                               4   0%
                  c-restore-string-fences                           1   0%
              - c-font-lock-invalid-single-quotes                   4   0%
               - c-literal-limits                                   2   0%
                  c-full-pp-to-literal                              2   0%
                #<compiled -0x1ffffffff8d28718>                     4   0%
                #<compiled -0x1ffffffff8d28948>                     3   0%
                #<compiled -0x1ffffffff8d28fb0>                     3   0%
                #<compiled -0x1ffffffff8d287b8>                     2   0%
                #<compiled -0x1ffffffff8d28ad8>                     2   0%
                c-font-lock-enum-body                               1   0%
                #<compiled -0x1ffffffffa13eaf0>                     1   0%
             - font-lock-fontify-syntactically-region                 11   0%
                syntax-ppss                                         7   0%
            - c-before-context-fl-expand-region                   108   0%
             - mapc                                               108   0%
              - #<compiled -0x1ffffffff8d25220>                   108   0%
               - c-context-expand-fl-region                       108   0%
                - c-fl-decl-end                                    79   0%
                 - c-slow-enclosing-c++-attribute                  74   0%
                  - c-parse-state                                  74   0%
                   - c-parse-state-1                               73   0%
                      c-append-to-state-cache                      50   0%
                    - c-remove-stale-state-cache                   17   0%
                     - c-beginning-of-macro                         2   0%
                        #<compiled -0x1ffffffff8c48290>                  1   0%
                    - c-parse-state-get-strategy                    5   0%
                     - c-get-fallback-scan-pos                      5   0%
                      - beginning-of-defun                          5   0%
                         beginning-of-defun-raw                     5   0%
                      c-beginning-of-macro                          1   0%
                   - c-beginning-of-macro                           1   0%
                      #<compiled -0x1ffffffff8c48290>                  1   0%
                 - c-literal-start                                  2   0%
                    c-semi-pp-to-literal                            2   0%
                   c-beginning-of-macro                             1   0%
                   c-on-identifier                                  1   0%
                   c-backward-sws                                   1   0%
                - c-fl-decl-start                                  29   0%
                 - c-determine-limit                               13   0%
                  - c-semi-pp-to-literal                            2   0%
                   - #<compiled -0x1ffffffff8c41948>                  1   0%
                      c-clear-string-fences                         1   0%
                    c-backward-sws                                  1   0%
                   c-literal-start                                  2   0%
                   c-syntactic-skip-backward                        1   0%
            - #<compiled -0x1ffffffff8d25120>                       1   0%
               c-clear-string-fences                                1   0%
     - eval                                                         1   0%
        if                                                          1   0%
   - execute-extended-command                                       2   0%
    - sit-for                                                       2   0%
     - redisplay                                                    1   0%
      - redisplay_internal (C function)                             1   0%
       - find-image                                                 1   0%
          image-search-load-path                                    1   0%
  - byte-code                                                       3   0%
   - read-extended-command                                          3   0%
    - completing-read                                               3   0%
     - completing-read-default                                      3   0%
        read-from-minibuffer                                        1   0%
+ redisplay_internal (C function)                                3078  24%
+ ...                                                             437   3%





  reply	other threads:[~2019-11-02  7:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-27 23:04 bug#10149: Emacs 24 hangs for several minutes with very large c++ files suvayu ali
2019-11-01 23:14 ` Stefan Kangas
2019-11-02  7:31   ` Eli Zaretskii [this message]
2019-11-02 10:09   ` Alan Mackenzie
2019-11-02 10:31     ` Stefan Kangas
2019-11-02 13:07       ` Alan Mackenzie

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=83r22qka3g.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=10149@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=fatkasuvayu+linux@gmail.com \
    --cc=stefan@marxist.se \
    /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).