leoliu / ggtags

Emacs frontend to GNU Global source code tagging system.
http://elpa.gnu.org
578 stars 56 forks source link

ggtags frozen emacs for several seconds #194

Closed mtellezj closed 5 years ago

mtellezj commented 5 years ago

I have emacs frozen at random intervals (2-10 minutes between intervals) when I'm doing basic python editing. the cpu fan start to spinnig very fast and top show me that emacs is using 100% cpu. I ran profiler and I get this:

- #<compiled 0x227c3f1>                                         57636  91%
 - #<compiled 0x2125339>                                        57636  91%
  - ggtags-get-definition-default                               56657  89%
   - ggtags-fontify-code                                        56657  89%
    + font-lock-ensure                                          56641  89%
    + python-mode                                                  12   0%
  + #<compiled 0x20571bd>                                         963   1%
+ ...                                                            2718   4%
+ command-execute                                                1732   2%
+ timer-event-handler                                             497   0%
+ redisplay_internal (C function)                                 320   0%
+ jsonrpc--process-filter                                         228   0%
+ #<compiled 0x13ba999>                                            11   0%
+ eldoc-pre-command-refresh-echo-area                               6   0%
+ flycheck-perform-deferred-syntax-check                            4   0%
  sp--save-pre-command-state                                        2   0%
  mouse-fixup-help-message                                          1   0%
+ flycheck-handle-signal                                            1   0%

another profiler report:

- #<compiled 0x2383959>                                        257895  92%
 - #<compiled 0x2383891>                                       257895  92%
  - ggtags-get-definition-default                              255117  91%
   - ggtags-fontify-code                                       255113  91%
    - font-lock-ensure                                         255081  91%
     - #<compiled 0x4bbfdd>                                    255081  91%
      - font-lock-default-fontify-buffer                       255081  91%
       - font-lock-fontify-region                              255077  91%
        - font-lock-default-fontify-region                     255077  91%
         - font-lock-fontify-syntactically-region              255077  91%
          - python-font-lock-syntactic-face-function             254469  91%
           - python-info-docstring-p                           254469  91%
            - python-info-assignment-statement-p               250438  90%
             - python-syntax-context-type                      179121  64%
              - syntax-ppss                                    171772  61%
                 #<compiled 0x2415df9>                            136   0%
               match-string-no-properties                        1035   0%
          + syntax-propertize                                     596   0%
       + font-lock-unfontify-buffer                                 4   0%
    + python-mode                                                  28   0%
  + #<compiled 0x229ee59>                                        2766   0%
+ ...                                                           10144   3%
+ eldoc-pre-command-refresh-echo-area                            5588   2%
+ timer-event-handler                                            2448   0%
+ command-execute                                                 825   0%
+ redisplay_internal (C function)                                 356   0%
+ company-post-command                                            356   0%
+ flycheck-handle-signal                                          338   0%
+ #<compiled 0x229fe59>                                            12   0%
  jsonrpc--process-filter                                           8   0%
+ sp--save-pre-command-state                                        8   0%
+ yas-maybe-expand-abbrev-key-filter                                4   0%
  winner-save-old-configurations                                    4   0%

Now I disable elpy and company but without luck. Any help?

leoliu commented 5 years ago

I think ggtags-fontify-code is triggered by eldoc-mode. More specifically it looks like font-locking python in a temp buffer has issues. Somehow python-info-docstring-p is very expensive there.

mtellezj commented 5 years ago

Hi, thanks for the reply. I disable eldoc-mod and everything is running smooth. Should I open a bug on eldoc or this is ggtags realted?

leoliu commented 5 years ago

@mtellezj Neither. I think this is likely an issue with python-mode but I am clueless since I don't use python and the emacs mode I use is from many years ago.

mtellezj commented 5 years ago

Thanks a lot. I'll check with python mode.