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:
parent
1dac4ac37b
commit
b7f84bdd01
1 changed files with 30 additions and 26 deletions
|
@ -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,31 +86,35 @@ 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)
|
||||||
(while packages
|
(if (and packages (bound-and-true-p comp-files-queue))
|
||||||
(let* ((gc-cons-threshold most-positive-fixnum)
|
(run-with-idle-timer doom-incremental-idle-timer
|
||||||
(req (pop packages)))
|
nil #'doom-load-packages-incrementally
|
||||||
(unless (featurep req)
|
packages t)
|
||||||
(doom-log "Incrementally loading %s" req)
|
(while packages
|
||||||
(condition-case-unless-debug e
|
(let* ((gc-cons-threshold most-positive-fixnum)
|
||||||
(or (while-no-input
|
(req (pop packages)))
|
||||||
;; If `default-directory' is a directory that doesn't exist
|
(unless (featurep req)
|
||||||
;; or is unreadable, Emacs throws up file-missing errors, so
|
(doom-log "Incrementally loading %s" req)
|
||||||
;; we set it to a directory we know exists and is readable.
|
(condition-case-unless-debug e
|
||||||
(let ((default-directory doom-emacs-dir)
|
(or (while-no-input
|
||||||
(inhibit-message t)
|
;; If `default-directory' is a directory that doesn't exist
|
||||||
file-name-handler-alist)
|
;; or is unreadable, Emacs throws up file-missing errors, so
|
||||||
(require req nil t))
|
;; we set it to a directory we know exists and is readable.
|
||||||
t)
|
(let ((default-directory doom-emacs-dir)
|
||||||
(push req packages))
|
(inhibit-message t)
|
||||||
(error
|
file-name-handler-alist)
|
||||||
(message "Failed to load %S package incrementally, because: %s"
|
(require req nil t))
|
||||||
req e)))
|
t)
|
||||||
(if (not packages)
|
(push req packages))
|
||||||
(doom-log "Finished incremental loading")
|
(error
|
||||||
(run-with-idle-timer doom-incremental-idle-timer
|
(message "Failed to load %S package incrementally, because: %s"
|
||||||
nil #'doom-load-packages-incrementally
|
req e)))
|
||||||
packages t)
|
(if (not packages)
|
||||||
(setq packages nil)))))))
|
(doom-log "Finished incremental loading")
|
||||||
|
(run-with-idle-timer doom-incremental-idle-timer
|
||||||
|
nil #'doom-load-packages-incrementally
|
||||||
|
packages t)
|
||||||
|
(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'.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue