feat: increase garbage collection threshold always

This commit is contained in:
Laurens Miers 2023-06-07 10:50:33 +02:00
parent f1f6b38b6c
commit a581a36f55

View file

@ -6,6 +6,7 @@
* TABLE OF CONTENTS :toc:
- [[#installation][Installation]]
- [[#garbage-collection][Garbage collection]]
- [[#base-packages-to-install-first][Base packages to install first]]
- [[#elpaca][Elpaca]]
- [[#utils][Utils]]
@ -23,7 +24,6 @@
- [[#macros][Macro's]]
- [[#goto-line][Goto-line]]
- [[#rectangle][Rectangle]]
- [[#garbage-collection-gc][Garbage collection (gc)]]
- [[#yes-or-no-questions][Yes-or-no questions]]
- [[#emacs-fullscreen-at-startup][Emacs fullscreen at startup]]
- [[#enable-disabled-commands][Enable disabled commands]]
@ -116,8 +116,15 @@ This configuration requires the installation of :
=pip install jedi flake8 importmagic autopep8 yapf=
- =ditaa= (for ascii to image generation in org-mode)
* Base packages to install first
** Garbage collection
Increase GC threshold to minimize time wasting:
#+BEGIN_SRC emacs-lisp
(setq gc-cons-threshold 20000000) ;; 20 MB
#+END_SRC
* Base packages to install first
** Elpaca
Replacement for built-in package manager package.el :
@ -442,30 +449,6 @@ so rebind it to something easy to remember.
(global-set-key (kbd "C-x r r") 'query-replace-regexp)
#+END_SRC
** Garbage collection (gc)
A lot of articles/sites/posts/... about this:
- [[https://lists.gnu.org/archive/html/help-gnu-emacs/2007-06/msg00243.html ]]
- https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/
- ...
This just contains some hooks to stop/enable the GC at critical moments.
I'm not touching the value except during startup.
If I leave it too high, I got a lot of lag when using LSP mode, so just leave it at the default value.
I just 'Disable' GC in the minibuffer, I don't want lags/hangups/... in the minibuffer.
#+BEGIN_SRC emacs-lisp
(defun my-minibuffer-setup-hook ()
(setq gc-cons-threshold most-positive-fixnum))
(defun my-minibuffer-exit-hook ()
(setq gc-cons-threshold 800000))
(add-hook 'minibuffer-setup-hook #'my-minibuffer-setup-hook)
(add-hook 'minibuffer-exit-hook #'my-minibuffer-exit-hook)
#+END_SRC
** Yes-or-no questions
Because I'm lazy, important yes-or-no questions can be answered with y-or-n: