From d633c15042351766171912aab6fdaabbf1922037 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Sep 2024 15:49:50 -0400 Subject: [PATCH] perf(cc): lsp-clangd: halve core count for indexing Ref: cec81ac2ccdb --- modules/lang/cc/config.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index 3a6e1cd64..789c6fca2 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -160,7 +160,12 @@ This is ignored by ccls.") cuda-mode-local-vars-hook) :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")) ;; Map eglot specific helper @@ -203,6 +208,8 @@ This is ignored by ccls.") (featurep :system 'linux)) (setq ccls-initialization-options `(: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)))))) (when (featurep :system 'macos) (setq ccls-initialization-options