tigersoldier / company-lsp

Company completion backend for lsp-mode
GNU General Public License v3.0
251 stars 26 forks source link

sit-for seems to take too much time. #117

Closed itome closed 5 years ago

itome commented 5 years ago

Hi, I'm using package for dart lang completion with lsp-mode. sit-for may takes too much amount of cpu usage. Relate issue in lsp-mode -> https://github.com/emacs-lsp/lsp-mode/issues/851

- timer-event-handler                                            7861  40%
 - apply                                                         7861  40%
  - company-idle-begin                                           7325  38%
   - company-auto-begin                                          7271  37%
    - company--perform                                           7271  37%
     - company--begin-new                                        7271  37%
      - company-calculate-candidates                             7267  37%
       - company--fetch-candidates                               7264  37%
        - sit-for                                                7215  37%
         - read-event                                            4481  23%
          - #<compiled 0x460876f9>                               4105  21%
           - lsp--parser-on-message                              3290  17%
            - lsp--read-json                                     3269  17%
             - json-read-from-string                             3244  16%
              - json-read                                        3237  16%
               - json-read-object                                3237  16%
                - json-read                                      3236  16%
                 - json-read-array                               3232  16%
                  - json-read                                    3228  16%
                   - json-read-object                            3204  16%
                    - json-read                                  2602  13%
                     - json-read-object                          1443   7%
                        json-new-object                           902   4%
                      - json-read                                 462   2%
                       - json-read-object                         353   1%
                          json-new-object                         329   1%
                          json-read                                 9   0%
                         json-read-number                          13   0%
                        json-add-to-object                          2   0%
                       json-read-string                            27   0%
                       json-read-number                            20   0%
                       json-read-keyword                            1   0%
                      json-new-object                             368   1%
                      json-add-to-object                            5   0%
                 + json-read-object                                 2   0%
                  json-new-object                                   1   0%
              + #<compiled 0x45b59525>                              7   0%
            + #<compiled 0x45029e35>                               10   0%
            + lsp--on-notification                                  9   0%
            + #<compiled 0x45acdd6d>                                2   0%
             lsp--parser-read                                     545   2%
          + timer-event-handler                                   373   1%
          + #<compiled 0x46090a8d>                                  2   0%
          + command-execute                                         1   0%
         + input-pending-p                                         41   0%
        + #<compiled 0x45070779>                                   34   0%
        + company-call-backend-raw                                 15   0%
       + company--preprocess-candidates                             3   0%
      + company--multi-backend-adapter                              3   0%
   + company-post-command                                          54   0%
  + sp-show--pair-function                                        226   1%
  + #<compiled 0x45f98355>                                        144   0%
  + auto-revert-buffers                                            77   0%
  + #<compiled 0x42136c49>                                         39   0%
  + auto-save-buffers-enhanced-save-buffers                        21   0%
  + #<compiled 0x40105275>                                         11   0%
  + #<compiled 0x45e827e9>                                          8   0%
  + savehist-autosave                                               4   0%
    jit-lock-context-fontify                                        3   0%
  + hl-paren-highlight                                              2   0%
- ...                                                            7251  37%
   Automatic GC                                                  7248  37%
 - #<compiled 0x45a7b46d>                                           2   0%
  - json-encode                                                     2   0%
   + json-encode-list                                               2   0%
 + indent-line-to                                                   1   0%
+ #<compiled 0x460876f9>                                         1696   8%
+ command-execute                                                1320   6%
+ redisplay_internal (C function)                                 872   4%
+ company-post-command                                             90   0%
+ eldoc-pre-command-refresh-echo-area                              56   0%
+ lsp--highlight                                                    6   0%
+ winner-save-old-configurations                                    5   0%
+ evil-repeat-pre-hook                                              3   0%
+ evil-repeat-post-hook                                             2   0%
+ flycheck-display-error-at-point-soon                              2   0%
+ auto-compose-chars                                                2   0%
+ evil-escape-pre-command-hook                                      2   0%
+ #<compiled 0x5e6b4a71>                                            2   0%
+ global-hl-line-maybe-unhighlight                                  1   0%
+ lsp-ui-sideline                                                   1   0%
  company-pre-command                                               1   0%
+ eldoc-schedule-timer                                              1   0%
yyoncho commented 5 years ago

sit-for is used by company mode to wait for lsp-mode and language server to return(it does not take any time).

itome commented 5 years ago

I understand! This issue is not because of sit-for.