perf: defer incremental loading for nativecomp users

It'd be detrimental to runtime performance to incrementally load more
packages as Emacs is natively compiling others, so hold off on it a bit
longer.
This commit is contained in:
Henrik Lissner 2022-09-06 19:22:43 +02:00
parent 1dac4ac37b
commit b7f84bdd01
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -68,7 +68,7 @@ If you want to disable incremental loading altogether, either remove
`doom-incremental-first-idle-timer' to nil. Incremental loading does not occur `doom-incremental-first-idle-timer' to nil. Incremental loading does not occur
in daemon sessions (they are loaded immediately at startup).") in daemon sessions (they are loaded immediately at startup).")
(defvar doom-incremental-first-idle-timer 2.0 (defvar doom-incremental-first-idle-timer (if (featurep 'native-compile) 3.0 2.0)
"How long (in idle seconds) until incremental loading starts. "How long (in idle seconds) until incremental loading starts.
Set this to nil to disable incremental loading.") Set this to nil to disable incremental loading.")
@ -86,6 +86,10 @@ If NOW is non-nil, load PACKAGES incrementally, in `doom-incremental-idle-timer'
intervals." intervals."
(if (not now) (if (not now)
(appendq! doom-incremental-packages packages) (appendq! doom-incremental-packages packages)
(if (and packages (bound-and-true-p comp-files-queue))
(run-with-idle-timer doom-incremental-idle-timer
nil #'doom-load-packages-incrementally
packages t)
(while packages (while packages
(let* ((gc-cons-threshold most-positive-fixnum) (let* ((gc-cons-threshold most-positive-fixnum)
(req (pop packages))) (req (pop packages)))
@ -110,7 +114,7 @@ intervals."
(run-with-idle-timer doom-incremental-idle-timer (run-with-idle-timer doom-incremental-idle-timer
nil #'doom-load-packages-incrementally nil #'doom-load-packages-incrementally
packages t) packages t)
(setq packages nil))))))) (setq packages nil))))))))
(defun doom-load-packages-incrementally-h () (defun doom-load-packages-incrementally-h ()
"Begin incrementally loading packages in `doom-incremental-packages'. "Begin incrementally loading packages in `doom-incremental-packages'.