From 74ba7de1729381d8f6926c3bd9f4434a8d34dac6 Mon Sep 17 00:00:00 2001 From: Lars Tveito Date: Tue, 10 Mar 2020 20:17:34 +0100 Subject: [PATCH] Init optimization --- init.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/init.org b/init.org index b2638a3..6de977c 100644 --- a/init.org +++ b/init.org @@ -135,6 +135,16 @@ (load-file private-file)) (server-start)))) #+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. + + #+BEGIN_SRC emacs-lisp + (lexical-let ((old-gc-treshold gc-cons-threshold)) + (setq gc-cons-threshold most-positive-fixnum) + (add-hook 'after-init-hook + (lambda () (setq gc-cons-threshold old-gc-treshold)))) #+END_SRC ** Packages