Move performance optimizations into their own file

Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
magic_rb 2024-07-24 21:30:09 +02:00
parent bfefc99016
commit 9ee6c651be
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 33 additions and 24 deletions

View file

@ -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

View file

@ -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~.
<<lsp-rustic>>
;; <<lsp-rust-analyzer>>
<<gc-cons-threshold>>
<<read-process-output-max>>
<<lsp-completion-provider>>
;; <<lsp-idle-delay>>
<<lsp-typescript-tramp>>
<<lsp-scala-tramp>>)
#+END_SRC