perf(cc): lsp-clangd: halve core count for indexing

Ref: cec81ac2cc
This commit is contained in:
Henrik Lissner 2024-09-14 15:49:50 -04:00
parent 2e5307e425
commit d633c15042
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -160,7 +160,12 @@ This is ignored by ccls.")
cuda-mode-local-vars-hook) cuda-mode-local-vars-hook)
:append #'lsp!) :append #'lsp!)
(when (modulep! :tools lsp +eglot) (if (not (modulep! :tools lsp +eglot))
(after! lsp-clangd
;; Prevent clangd from consuming all your cores indexing larger projects
;; and grinding your system to a halt.
(cl-pushnew (format "-j=%d" (max 1 (/ (doom-system-cpus) 2)))
lsp-clients-clangd-args))
(set-eglot-client! 'cuda-mode '("clangd")) (set-eglot-client! 'cuda-mode '("clangd"))
;; Map eglot specific helper ;; Map eglot specific helper
@ -203,6 +208,8 @@ This is ignored by ccls.")
(featurep :system 'linux)) (featurep :system 'linux))
(setq ccls-initialization-options (setq ccls-initialization-options
`(:index (:trackDependency 1 `(:index (:trackDependency 1
;; Prevent ccls from consuming all your cores indexing
;; larger projects and grinding your system to a halt.
:threads ,(max 1 (/ (doom-system-cpus) 2)))))) :threads ,(max 1 (/ (doom-system-cpus) 2))))))
(when (featurep :system 'macos) (when (featurep :system 'macos)
(setq ccls-initialization-options (setq ccls-initialization-options