0

jit-lock-function consumes too much CPU and hangup my emacs frequentlly. Does anyone have met the same problem? How to solve this?

The OS is archlinux x64, CPU intel i7 4790, 16GB RAM. Only emacs is running except system services.

Thanks!

The profiler-report gives this:

- redisplay_internal (C function)                                2728  90%
 - jit-lock-function                                             2724  89%
  - jit-lock-fontify-now                                         2724  89%
   - jit-lock--run-functions                                     2724  89%
    - run-hook-wrapped                                           2724  89%
     - #<compiled 0x40f2001>                                     2724  89%
      - font-lock-fontify-region                                 2724  89%
       - c-font-lock-fontify-region                              2724  89%
        - font-lock-default-fontify-region                       2716  89%
         - font-lock-fontify-keywords-region                     2712  89%
          - c-font-lock-declarations                             1932  63%
           - c-find-decl-spots                                   1912  63%
            - #<compiled 0x22af545>                              1148  37%
             - c-get-fontification-context                        732  24%
              - c-looking-at-or-maybe-in-bracelist                504  16%
               + c-backward-token-2                               472  15%
              - c-back-over-member-initializers                   108   3%
               + c-back-over-compound-identifier                   56   1%
               + c-parse-state                                     32   1%
                 c-backward-sws                                     8   0%
              + c-back-over-compound-identifier                    68   2%
              + c-backward-token-2                                 16   0%
                c-backward-sws                                      4   0%
             + c-forward-decl-or-cast-1                           240   7%
             + c-forward-label                                     60   1%
             + c-backward-token-2                                  16   0%
             + c-backward-sws                                      12   0%
             + c-font-lock-single-decl                              8   0%
               c-syntactic-re-search-forward                        4   0%
            + c-bs-at-toplevel-p                                  672  22%
            + c-beginning-of-macro                                 28   0%
              c-forward-sws                                         8   0%
              c-backward-token-2                                    4   0%
            c-font-lock-<>-arglists                               304  10%
          + #<compiled 0x22b6359>                                  92   3%
            #<compiled 0x22b6381>                                  68   2%
            #<compiled 0x22b5fbd>                                  32   1%
            #<compiled 0x22b62b9>                                  32   1%
            #<compiled 0x22b625d>                                  28   0%
            #<compiled 0x22b62fd>                                  28   0%
            #<compiled 0x22b631d>                                  28   0%
            #<compiled 0x22b63d5>                                   8   0%
          + c-font-lock-enclosing-decls                             4   0%
            c-font-lock-enum-body                                   4   0%
            #<compiled 0x22b6669>                                   4   0%
           font-lock-fontify-syntactically-region                   4   0%
        + c-before-context-fl-expand-region                         8   0%
2
  • What are your system specs? Oct 16, 2019 at 3:45
  • ArchLinux x64, CPU is intel i7-4790, 16GB RAM. @music2myear
    – byhc
    Oct 16, 2019 at 4:48

1 Answer 1

0

Your finger-pointing is a bit off: 89% of the time is spent in jit-lock-function but all of this time is also spent in c-font-lock-fontify-region (called indirectly from jit-lock-function).

So your problem is with c-font-lock rather than with jit-lock.

Please report this as a bug via M-x report-emacs-bug. You'll probably want to give details about the content of the buffer in which it appears (I'll assume it's a C++ file).

If this is with an Emacs older than 26.3, it's probably worth trying it out with Emacs-26.3 before reporting the bug since font-lock performance in c++-mode has seen regular improvements over the years.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .