Closed huangfeiyu closed 2 years ago
I've already followed the instructions from https://emacs-lsp.github.io/lsp-mode/page/performance/.
In that same page, there is a description of how to report perf problems...
Thanks @yyoncho . Here's a report.
helm-fuzzy-search 53 0%
helm-display-mode-line 1 0% helm--update-move-first-line 1 0% helm-action-window 1 0%
apply 1 0%
electric-pair-syntax-info 1 0% clear-minibuffer-message 1 0%
helm-display-mode-line 2 0%
c-font-lock-doc-comments 1 0%
lsp--make-message 1 0%
call-process-shell-command 8 0% string-trim 6 0%
s-matches? 42 0%
s-matches? 3 0%
s-matches? 38 0%
s-matches? 2 0%
s-matches? 1 0%
lsp--send-no-wait 1 0%
dap-tooltip-mode 1 0%
c-syntactic-re-search-forward 2 0%
c-after-change-mark-abnormal-strings 1 0%
c-clear-string-fences 36 0%
c-semi-pp-to-literal 1 0%
apply 1 0%
apply 1 0%
c-syntactic-re-search-forward 1 0%
c-clear-string-fences 38 0% c-restore-string-fences 17 0%
lsp--make-message 2 0% lsp--send-no-wait 1 0% lsp--workspace-sync-method 1 0%
c-clear-string-fences 2 0%
c-clear-string-fences 1 0%
c-restore-<>-properties 1 0%
c-clear-string-fences 1 0%
c-clear-string-fences 1 0% c-unfind-enclosing-token 1 0%
lsp--make-message 1 0%
c-clear-string-fences 1 0%
c-clear-string-fences 1 0% c-restore-string-fences 1 0%
c-clear-string-fences 3 0%
lsp--send-no-wait 1 0%
apply 2 0%
lsp-modeline-diagnostics-statistics 1 0%
c-clear-string-fences 3 0%
apply 1 0%
c-clear-string-fences 4 0%
c-clear-string-fences 5 0%
c-restore-<>-properties 1 0% c-restore-string-fences 1 0%
apply 1 0% c-literal-start 1 0% c-after-change-mark-abnormal-strings 2 0%
c-clear-string-fences 2 0% c-restore-string-fences 2 0%
c-clear-string-fences 5 0%
c-clear-string-fences 3 0%
c-determine-limit 1 0%
c-clear-string-fences 5 0% c-restore-string-fences 2 0%
apply 1 0%
lsp--send-no-wait 1 0%
apply 1 0%
c-clear-string-fences 2 0%
lsp--send-no-wait 1 0%
lsp--make-message 1 0%
c-clear-string-fences 1 0% company-search-mode 1 0%
apply 2 0%
apply 1 0%
apply 2 0%
c-clear-string-fences 3 0% c-restore-string-fences 3 0%
c-clear-string-fences 3 0%
lsp--make-message 1 0%
apply 5 0%
file-remote-p 1 0%
helm-comp-read-get-candidates 3 0%
c-clear-string-fences 2 0%
c-before-change-check-unbalanced-strings 1 0%
c-clear-string-fences 2 0%
apply 1 0%
mapc 1 0%
c-clear-string-fences 3 0% c-restore-string-fences 3 0%
apply 1 0%
c-clear-string-fences 2 0% c-restore-string-fences 1 0%
lsp--make-message 1 0% lsp--text-document-content-change-event 1 0%
c-beginning-of-statement-1 1 0%
file-notify--watch-absolute-filename 1 0%
c-after-change-mark-abnormal-strings 1 0%
kill-buffer 1 0%
file-notify--watch-absolute-filename 1 0%
lsp-request 1 0%
c-clear-string-fences 1 0% c-beginning-of-decl-1 1 0%
thing-at-point-looking-at 2 0%
c-clear-string-fences 1 0%
apply 1 0%
c-clear-string-fences 2 0% c-restore-string-fences 1 0%
lsp--make-message 1 0%
c-clear-string-fences 4 0%
lsp--send-no-wait 1 0%
c-clear-string-fences 1 0%
c-clear-string-fences 1 0%
c-clear-string-fences 2 0%
c-after-change-mark-abnormal-strings 1 0%
file-notify--expand-file-name 1 0%
lsp--send-no-wait 2 0% lsp--make-message 1 0%
helm-display-mode-line 4 0%
cancel-timer-internal 1 0%
helm-display-mode-line 1 0%
helm-source--persistent-help-string 2 0%
mapcar 1 0%
That perf report is practically useless. You have to isolate the slow behavior and expand the nodes that take time. You have expanded only the node that is related to you doing M-x profiler-stop/M-x profiler-stop which typically you should bind to something to avoid including the wait time to select command in the perf report.
+ timer-event-handler 3540 28%
+ #<compiled 0x157c971fb7a1> 1786 14%
+ ... 1408 11%
+ redisplay_internal (C function) 1301 10%
+ company-post-command 533 4%
I am sorry, @yyoncho . I'll try do it again. Not every completion is slow, it is fine sometimes, it is extremely slow another sometimes. So I am not sure if the next completion is slow or not, so I can't only include one or fewer operation to reproduce it and include it in a report. Anyway now I know how to generate a report, next time when I experience continually slow, I can generate a report.
Hi @yyoncho Here's another profiler report, please see if it help or not. Thanks
Automatic GC 0 0%
helm-fuzzy-search 31 5%
jit-lock-context-fontify 1 0%
mapcar 1 0%
lsp--get-message-type 1 0% generate-new-buffer 1 0%
helm-comp-read-get-candidates 3 0%
c-clear-string-fences 1 0%
c-clear-string-fences 1 0%
c-clear-string-fences 1 0%
c-clear-string-fences 1 0%
apply 1 0%
apply 1 0%
c-clear-string-fences 1 0%
c-clear-string-fences 1 0%
c-clear-string-fences 1 0%
company--col-row 1 0%
jit-lock-context-fontify 2 0%
Hi @yyoncho just a reminder! Will you please check my last performance report when you get time? Thanks!
can you try setting lsp-java-completion-max-results to 10?
It appears fixed the slowness issue. Thank you @yyoncho !
Hi, the code completion is very slow with my emacs 27.1 and jdtls 1.12. especially when I have more java file opened, it get extremely slow, I see the jdtls is quite busy during code completion, the cpu usage is quite high. Except completion, everything else like go-to-definition, works pretty fine. I've already followed the instructions from https://emacs-lsp.github.io/lsp-mode/page/performance/. Can you please tell me what I can do else to improve the completion performance? Thanks a lot!