Reformat gc optimization & gc on focus-out
Also raises the gc upper limit to 512mb
This commit is contained in:
parent
ddb03c6335
commit
20596cd41f
2 changed files with 18 additions and 11 deletions
27
core/core.el
27
core/core.el
|
@ -245,16 +245,6 @@ original value of `symbol-file'."
|
|||
(funcall orig-fn symbol type)))
|
||||
(advice-add #'symbol-file :around #'doom*symbol-file)
|
||||
|
||||
;; To speed up minibuffer commands (like helm and ivy), defer garbage collection
|
||||
;; when the minibuffer is active. It may mean a pause when finished, but that's
|
||||
;; acceptable instead of pauses during.
|
||||
(defun doom|defer-garbage-collection ()
|
||||
(setq gc-cons-threshold doom-gc-cons-upper-limit))
|
||||
(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)
|
||||
|
||||
;; File+dir local variables are initialized after the major mode and its hooks
|
||||
;; have run. If you want hook functions to be aware of these customizations, add
|
||||
;; them to MODE-local-vars-hook instead.
|
||||
|
@ -273,6 +263,23 @@ original value of `symbol-file'."
|
|||
(add-hook 'after-change-major-mode-hook #'doom|run-local-var-hooks-if-necessary)
|
||||
|
||||
|
||||
;;
|
||||
;;; Garbage collector optimizations
|
||||
|
||||
;; To speed up minibuffer commands (like helm and ivy), defer garbage collection
|
||||
;; when the minibuffer is active. It may mean a pause when finished, but that's
|
||||
;; acceptable instead of pauses during.
|
||||
(defun doom|defer-garbage-collection ()
|
||||
(setq gc-cons-threshold doom-gc-cons-upper-limit))
|
||||
(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)
|
||||
|
||||
;; GC all sneaky breeky like
|
||||
(add-hook 'focus-out-hook 'garbage-collect)
|
||||
|
||||
|
||||
;;
|
||||
;;; Incremental lazy-loading
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue