From 3d81cb5162911d8a3008dd96bcc200cba1224750 Mon Sep 17 00:00:00 2001 From: larstvei Date: Fri, 22 Mar 2024 20:31:22 +0100 Subject: [PATCH] Fix faster startup time The gc-cons-threshold wasn't reset! I think this caused some lag, due to long gc breaks. --- init.org | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/init.org b/init.org index 965295c..c259af2 100644 --- a/init.org +++ b/init.org @@ -158,15 +158,18 @@ #+end_src - A common optimization is to temporarily disable garbage collection during - initialization. Here, we set the ~gc-cons-threshold~ to a ridiculously large - number, and restore the default value after initialization. +** Faster startup - #+begin_src emacs-lisp :tangle early-init.el + A common optimization is to temporarily disable garbage collection during + initialization. Here, we set the ~gc-cons-threshold~ to a ridiculously large + number, and restore the default value after initialization. - (setq gc-cons-threshold (* 100 1024 1024)) - - #+end_src + #+begin_src emacs-lisp :tangle early-init.el + (setq gc-cons-threshold most-positive-fixnum) + (add-hook 'after-init-hook + (lambda () + (setq gc-cons-threshold (* 1024 1024 20)))) + #+end_src * Packages