From 927a1b1e40ddb29af9682f2dc38436f24a60ce78 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 20 Apr 2020 21:23:20 +0200 Subject: emacs: better disable GC during startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- .emacs.d/init.org | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to '.emacs.d/init.org') diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 640fd89..407df06 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -83,11 +83,21 @@ Temporarily reduce garbage collection so startup time is lower. Idea taken from [[https://github.com/purcell][@purcell]]. #+BEGIN_SRC elisp - (defconst mssola-initial-gc-cons-threshold gc-cons-threshold - "Initial value of `gc-cons-threshold' at start-up time.") - (setq gc-cons-threshold (* 1024 1024 1024)) - (add-hook 'after-init-hook - (lambda () (setq gc-cons-threshold mssola-initial-gc-cons-threshold))) +(defconst mssola-initial-gc-cons-threshold gc-cons-threshold + "Initial value of `gc-cons-threshold' at start-up time.") + +(defconst mssola-initial-gc-cons-percentage gc-cons-percentage + "Initial value of `gc-cons-percentage' at start-up time.") + +;; Completely disable the GC by having a ginormous threshold. +(setq gc-cons-threshold most-positive-fixnum + gc-cons-percentage 0.6) + +;; Enable the GC back again to its +(add-hook 'after-init-hook + (lambda () + (setq gc-cons-threshold mssola-initial-gc-cons-threshold + gc-cons-percentage mssola-initial-gc-cons-percentage))) #+END_SRC User name and email. -- cgit v1.2.3