Fix lag in LSP mode due to garbage collection

Used profiler to determine more than 80% of time was spent in garbage
collection...
Lowering the value back to the default fixes the lag.
This commit is contained in:
laurensmiers 2020-04-20 14:07:56 +02:00
parent e9b132d7e8
commit 586aa741df
2 changed files with 31 additions and 12 deletions

19
init.el
View file

@ -17,12 +17,19 @@
(package-refresh-contents)
(package-install 'use-package))
;; This is the actual config file. It is omitted if it doesn't exist so emacs won't refuse to launch.
(when (file-readable-p "~/.emacs.d/config.org")
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
;;; Increase garbage collection threshold during init but leave it to the default value after
;;; There are a LOT of articles/sites/... discussing this:
;;; https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/
;;; https://jonnay.github.io/emagicians-starter-kit/Emagician-Base.html
;;; ...
(let ((gc-cons-threshold most-positive-fixnum))
;; This is the actual config file. It is omitted if it doesn't exist so emacs won't refuse to launch.
(when (file-readable-p "~/.emacs.d/config.org")
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
;; If it exists, load some project-specific configurations.
(when (file-readable-p "~/.emacs.d/project.org")
(org-babel-load-file (expand-file-name "~/.emacs.d/project.org")))
;; If it exists, load some project-specific configurations.
(when (file-readable-p "~/.emacs.d/project.org")
(org-babel-load-file (expand-file-name "~/.emacs.d/project.org")))
)
(provide 'init)