Move GC optimization to init.el
And reformat core.el
This commit is contained in:
parent
2cb5d895d7
commit
2525822791
2 changed files with 29 additions and 24 deletions
16
init.el
16
init.el
|
@ -45,7 +45,21 @@ decrease this. If you experience stuttering, increase this.")
|
|||
;; Do this on idle timer to defer a possible GC pause that could result; also
|
||||
;; allows deferred packages to take advantage of these optimizations.
|
||||
(run-with-idle-timer
|
||||
3 nil (lambda () (setq-default gc-cons-threshold doom-gc-cons-threshold))))
|
||||
3 nil
|
||||
(lambda ()
|
||||
(setq-default gc-cons-threshold doom-gc-cons-threshold)
|
||||
;; To speed up minibuffer commands (like helm and ivy), we defer garbage
|
||||
;; collection while the minibuffer is active.
|
||||
(defun doom|defer-garbage-collection ()
|
||||
(setq gc-cons-threshold doom-gc-cons-upper-limit))
|
||||
(defun doom|restore-garbage-collection ()
|
||||
;; Defer it so that commands launched from the minibuffer can enjoy the
|
||||
;; benefits.
|
||||
(run-at-time 1 nil (lambda () (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)
|
||||
;; GC all sneaky breeky like
|
||||
(add-hook 'focus-out-hook #'garbage-collect))))
|
||||
|
||||
|
||||
(if (ignore-errors (or after-init-time noninteractive))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue