Reset gc-cons-threshold on idle timer
And remove reset from doom-reload-hook, as it is no longer necessary anymore. ~/.emacs.d/init.el is no longer re-evaluated at any point.
This commit is contained in:
parent
1f3fa61c2b
commit
937f118e6a
1 changed files with 8 additions and 8 deletions
16
init.el
16
init.el
|
@ -41,8 +41,11 @@ decrease this. If you experience stuttering, increase this.")
|
|||
"Resets garbage collection settings to reasonable defaults (a large
|
||||
`gc-cons-threshold' can cause random freezes otherwise) and resets
|
||||
`file-name-handler-alist'."
|
||||
(setq file-name-handler-alist doom--file-name-handler-alist
|
||||
gc-cons-threshold doom-gc-cons-threshold))
|
||||
(setq-default file-name-handler-alist doom--file-name-handler-alist)
|
||||
;; Do it on an idle timer to defer the possible GC pause, and to give deferred
|
||||
;; packages the opportunity to take advantage of these optimizations.
|
||||
(run-with-idle-timer
|
||||
3 nil (lambda () (setq-default gc-cons-threshold doom-gc-cons-threshold))))
|
||||
|
||||
|
||||
(if (or after-init-time noninteractive)
|
||||
|
@ -50,15 +53,12 @@ decrease this. If you experience stuttering, increase this.")
|
|||
;; A big contributor to long startup times is the garbage collector, so we up
|
||||
;; its memory threshold, temporarily and reset it later in
|
||||
;; `doom|disable-startup-optimizations'.
|
||||
(setq gc-cons-threshold doom-gc-cons-upper-limit) ; 256mb
|
||||
(setq gc-cons-threshold doom-gc-cons-upper-limit)
|
||||
;; This is consulted on every `require', `load' and various file reading
|
||||
;; functions. You get a minor speed up by nooping this.
|
||||
(setq file-name-handler-alist nil)
|
||||
;; Restore these to their defaults later. Do it on an idle timer to defer the
|
||||
;; possible GC pause, and to give deferred packages the ability to take
|
||||
;; advantage of these optimizations.
|
||||
(run-with-idle-timer 5 nil #'doom|restore-startup-optimizations)
|
||||
(add-hook 'doom-reload-hook #'doom|restore-startup-optimizations))
|
||||
;; Not restoring these to their defaults will cause stuttering/freezes.
|
||||
(add-hook 'emacs-startup-hook #'doom|restore-startup-optimizations))
|
||||
|
||||
|
||||
;; Ensure Doom is always running out of this file's directory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue