Open hikycool opened 2 years ago
step4 And now the cpu turn high(almost 100%)
What is the process taking 100% CPU?
The CPU report: lsp_cpu_high_report.log
This link is dead.
step4 And now the cpu turn high(almost 100%)
What is the process taking 100% CPU?
The CPU report: lsp_cpu_high_report.log
This link is dead.
In report shows that:
reupdate report lsp_cpu_high_report (1).log :)
(setq lsp-lens-enable nil)
will make the issue go away. We have to figure out why lenses are so slow in c-mode.
cc @ericdallo
(setq lsp-lens-enable nil)
will make the issue go away. We have to figure out why lenses are so slow in c-mode.
I have tried this config in my .emacs file, set it to be 'nil'. But there is another problem:
When I open the first .c file, it works. Then I open another .h file, lsp will connect to ccls process, and "lsp-lens-mode" will be enable automatically.
This would be another problem about that.
When I open the first .c file, it works. Then I open another .h file, lsp will connect to ccls process, and "lsp-lens-mode" will be enable automatically.
This would be another problem about that.
I tested and it seems like it works fine.
My lsp version: 20211023.2009. Should I upgrade or try older one ?
Test with lsp-start-plain.el as described in bug template.
Test with lsp-start-plain.el as described in bug template.
OK. I will try
I wonder how many lenses C returns for a buffer to have this performance issue
I wonder how many lenses C returns for a buffer to have this performance issue
Any way to show the number of lenses ? Or you can reproduce by using redis code file: src/server.h and src/server.c which i have met problem.
@hikycool you can get it following this, this should help understand what server is returning on the textDocument/codeLens
and textDocument/resolveCodeLens
I wonder how many lenses C returns for a buffer to have this performance issue
Thanks a lot I have saw the log: " received response 'textDocument/codeLens'" json the src/server.h has 2581 response the src/server.c has has 459 response
yeah, not sure if the server is using textDocument/resolveCodeLens
which increase performance, otherwise client will request all those 2581
lens, right @yyoncho ?
I believe the issue is a combination of our code and the slowness of the fontlock of c-mode. Most likely we should use a smarter way to check if the codelens is out of the visible area
Reproduce with lsp-lens-enable
default value t, when browsing emacs source code, especially large ones like src/eval.c
. I turn it off and the problem goes away. I don't know what lsp-lens
does anyway, so it doesn't affect me. :rofl:
Hi! Is there any progress on this issue? Or is it irrelevant completely? Maybe popular LSP servers for C/C++ do not provide anything useful via lenses anyway? Is the last assumption true?
For anyone interested, it seems that @MaskRay made some workaround to this in his config for emacs-ccls
:
For anyone interested, it seems that @MaskRay made some workaround to this in his config for
emacs-ccls
:* https://github.com/MaskRay/Config/blob/master/home/.config/doom/modules/private/my-cc/config.el#L74 * https://github.com/MaskRay/Config/blob/master/home/.config/doom/modules/private/my-cc/config.el#L88
The issue is at least tolerable on my side with these tweaks.
The performance on large files for lens is extremely poor. You should be able to reproduce the issue by trying to open one of the big files in the Surge synthesizer, https://github.com/surge-synthesizer/surge/blob/94e29c1a23758a4687c84fdb827769c9159945a9/src/surge-xt/gui/SurgeGUIEditor.cpp
Emacs will become basically unusable until lens is disabled.
Thank you for the bug report
lsp-mode
related packages.where
lsp-start-plain.el
can be downloaded here.Bug description
Problem: LSP-Mode CPU high, When I visit redis code file: src/server.h and src/server.cc at same time with two split window. And the process alway keep almost 100% CPU.
The CPU report: lsp_cpu_high_report.log
Backend: ccls OS: macos11.6 also reproduce in ubuntu docker container emacs veresion: both emacs-27 emacs-28
My Configuration: ;;---------------LSP---------------------------------
(setq package-selected-packages '(lsp-mode yasnippet lsp-treemacs helm-lsp projectile hydra flycheck company avy which-key helm-xref dap-mode))
(when (cl-find-if-not #'package-installed-p package-selected-packages) (package-refresh-contents) (mapc #'package-install package-selected-packages))
;; sample `helm' configuration use https://github.com/emacs-helm/helm/ for details (helm-mode) (require 'helm-xref) (define-key global-map [remap find-file] #'helm-find-files) (define-key global-map [remap execute-extended-command] #'helm-M-x) (define-key global-map [remap switch-to-buffer] #'helm-mini)
(which-key-mode) (add-hook 'c-mode-hook 'lsp) (add-hook 'c++-mode-hook 'lsp) (add-hook 'go-mode-hook #'lsp-deferred)
(setq gc-cons-threshold ( 1024 1024 1024) read-process-output-max ( 1024 1024) treemacs-space-between-root-nodes nil company-idle-delay 0.0 company-minimum-prefix-length 1 lsp-idle-delay 0.5) ;; clangd is fast
(setq lsp-log-io nil)
;; ---- c/c++ ---------- (with-eval-after-load 'lsp-mode (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration) (require 'dap-cpptools) (yas-global-mode))
(use-package ccls :hook ((c-mode c++-mode objc-mode cuda-mode) . (lambda () (require 'ccls) (lsp)))) (setq ccls-executable "/usr/local/bin/ccls") (setq ccls-args '("--log-file=/tmp/ccls.log")) ;; ---------------------
Steps to reproduce
Prepare
step1 open src/server.c
step2 C-x 3 split a new window
step3 open src/server.h
step4 And now the cpu turn high(almost 100%)
Backend: ccls OS: macos11.6 also reproduce in ubuntu docker container (User lsp-docker) emacs veresion: both emacs-27 emacs-28
Expected behavior
Expect: the CPU become normal load.
Which Language Server did you use?
Server: ccls
OS
MacOS
Error callstack
No response
Anything else?
No response