From 9ee6c651beefeb3ccaeec3896ddf51354531b669 Mon Sep 17 00:00:00 2001 From: magic_rb Date: Wed, 24 Jul 2024 21:30:09 +0200 Subject: [PATCH] Move performance optimizations into their own file Signed-off-by: magic_rb --- emacs-lisp/performance.org | 33 +++++++++++++++++++ .../modules/emacs/.emacs.d/org/base.org | 24 -------------- 2 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 emacs-lisp/performance.org diff --git a/emacs-lisp/performance.org b/emacs-lisp/performance.org new file mode 100644 index 0000000..9d31dd7 --- /dev/null +++ b/emacs-lisp/performance.org @@ -0,0 +1,33 @@ +:PROPERTIES: +:header-args:emacs-lisp: :comments link :results none +:ID: 658bcc84-4814-4b84-a697-f71bf1a54e9c +:END: +#+title: Performance +#+filetags: emacs-load +Increase the amount of data Emacs reads from a process in one go, default is 4KB, but some LSP servers produce responses up to 24MB. + +#+begin_src emacs-lisp + (when (boundp 'read-process-output-max) + (setq ; process-adaptive-read-buffering nil + read-process-output-max (* 24 1024 1024))) +#+end_src + +Increase GC threshold to avoid random freezes on garbage collection. + +#+NAME: gc-cons-threshold +#+BEGIN_SRC emacs-lisp :tangle no + (setq gc-cons-threshold (* 1024 1024 256)) +#+END_SRC + +Set the minimum delay between LSP refreshes, should help with performance when typing really fast. + +#+NAME: lsp-idle-delay +#+BEGIN_SRC emacs-lisp :tangle no + (setq lsp-idle-delay 0.250) +#+END_SRC + +Skip fontification on input, mostly helps with scrolling when Emacs cannot keep up withe fontification. + +#+begin_src emacs-lisp + (setq redisplay-skip-fontification-on-input t) +#+end_src diff --git a/home-manager/modules/emacs/.emacs.d/org/base.org b/home-manager/modules/emacs/.emacs.d/org/base.org index ebaf4db..c4e4e39 100644 --- a/home-manager/modules/emacs/.emacs.d/org/base.org +++ b/home-manager/modules/emacs/.emacs.d/org/base.org @@ -87,20 +87,6 @@ Enable ~envrc~, which changes ENVs on a per buffer basis. ** lsp-mode -Increase GC threshold to avoid random freezes on garbage collection. - -#+NAME: gc-cons-threshold -#+BEGIN_SRC emacs-lisp :tangle no - (setq gc-cons-threshold 100000000) -#+END_SRC - -Increase the amount of data Emacs reads from a process in one go, default is 4KB, but some LSP servers produce responses up to 3MB. - -#+NAME: read-process-output-max -#+BEGIN_SRC emacs-lisp :tangle no - (setq read-process-output-max (* (* 1024 1024) 3)) -#+END_SRC - Switch completion provider to =capf=, even though it should be the default, but just to make sure it. =company-lsp= is what =lsp-mode= switched away from. @@ -109,13 +95,6 @@ is what =lsp-mode= switched away from. (setq lsp-completion-provider :capf) #+END_SRC -Set the minimum delay between LSP refreshes, should help with performance when typing really fast. - -#+NAME: lsp-idle-delay -#+BEGIN_SRC emacs-lisp :tangle no - (setq lsp-idle-delay 0.500) ;; adjust me -#+END_SRC - Setup rustic to prefer ~rust-analyzer~ instead of ~rls~ and also don't format on save, it's really annoying. #+NAME: lsp-rustic @@ -147,10 +126,7 @@ Finally enable ~lsp-mode~. <> ;; <> - <> - <> <> - ;; <> <> <>) #+END_SRC