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)))
|
(funcall orig-fn symbol type)))
|
||||||
(advice-add #'symbol-file :around #'doom*symbol-file)
|
(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
|
;; 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
|
;; have run. If you want hook functions to be aware of these customizations, add
|
||||||
;; them to MODE-local-vars-hook instead.
|
;; 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)
|
(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
|
;;; Incremental lazy-loading
|
||||||
|
|
||||||
|
|
2
init.el
2
init.el
|
@ -31,7 +31,7 @@
|
||||||
"The default value to use for `gc-cons-threshold'. If you experience freezing,
|
"The default value to use for `gc-cons-threshold'. If you experience freezing,
|
||||||
decrease this. If you experience stuttering, increase this.")
|
decrease this. If you experience stuttering, increase this.")
|
||||||
|
|
||||||
(defvar doom-gc-cons-upper-limit 268435456 ; 256mb
|
(defvar doom-gc-cons-upper-limit 536870912 ; 512mb
|
||||||
"The temporary value for `gc-cons-threshold' to defer it.")
|
"The temporary value for `gc-cons-threshold' to defer it.")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue