From daef19ba640d920c3105a394decfc3afe1189254 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 2 Sep 2018 17:06:12 +0200 Subject: [PATCH] Defer garbage collection in the minibuffer This can speed up things that run in or from the minibuffer, like projectile/helm/ivy commands. --- core/core.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/core.el b/core/core.el index 90a2d67d1..410067e9e 100644 --- a/core/core.el +++ b/core/core.el @@ -298,6 +298,14 @@ original value of `symbol-file'." ;; Truly silence startup message (fset #'display-startup-echo-area-message #'ignore) +;; Don't garbage collect to speed up minibuffer commands +(defun doom|defer-garbage-collection () + (setq gc-cons-threshold most-positive-fixnum)) +(defun doom|restore-garbage-collection () + (setq gc-cons-threshold doom-gc-cons-threshold)) +(add-hook 'minibuffer-setup-hook #'doom|defer-garbage-collection) +(add-hook 'minibuffer-exit-hook #'doom|restore-garbage-collection) + ;; ;; Bootstrap helpers