perf: custom-dont-initialize = t
defcustom does some initialization work to accommodate the possibility that the user has set the variable before it was defined. This work is unneeded so early at startup, so I disable it (temporarily). In the future, Doom will use defcustom more, as it's a helpful indication to readers what variables I intended for configuration (and helps with discovery of options through `M-x doom/help-custom-variable` or `M-x customize`). As that transition occurs, the benefit of this optimization will begin to show, but for now its effect on startup time is negligible. * lisp/doom.el (warning-suppress-types): set this immediately. Since its default value is nil and this happens so early at startup, we don't have to be considerate of defaults. Plus, this custom-dont-initialize optimization can cause breakage if a warning is thrown *before* before this setting is changed.
This commit is contained in:
parent
1c32e317cc
commit
8c442d84b9
1 changed files with 11 additions and 2 deletions
13
lisp/doom.el
13
lisp/doom.el
|
@ -406,6 +406,16 @@ users).")
|
||||||
(setq load-suffixes (get 'load-suffixes 'initial-value)
|
(setq load-suffixes (get 'load-suffixes 'initial-value)
|
||||||
load-file-rep-suffixes (get 'load-file-rep-suffixes 'initial-value))))
|
load-file-rep-suffixes (get 'load-file-rep-suffixes 'initial-value))))
|
||||||
|
|
||||||
|
;; PERF: Doom uses `defcustom' to indicate variables that users are expected
|
||||||
|
;; to reconfigure. Trouble is it fires off initializers meant to
|
||||||
|
;; accommodate any user attempts to configure them before they were
|
||||||
|
;; defined. This is unnecessary before $DOOMDIR/init.el is loaded, so I
|
||||||
|
;; disable them until it is.
|
||||||
|
(setq custom-dont-initialize t)
|
||||||
|
(add-hook! 'doom-before-init-hook
|
||||||
|
(defun doom--reset-custom-dont-initialize-h ()
|
||||||
|
(setq custom-dont-initialize nil)))
|
||||||
|
|
||||||
;; PERF: The mode-line procs a couple dozen times during startup. This is
|
;; PERF: The mode-line procs a couple dozen times during startup. This is
|
||||||
;; normally quite fast, but disabling the default mode-line and reducing the
|
;; normally quite fast, but disabling the default mode-line and reducing the
|
||||||
;; update delay timer seems to stave off ~30-50ms.
|
;; update delay timer seems to stave off ~30-50ms.
|
||||||
|
@ -584,8 +594,7 @@ Otherwise, `en/disable-command' (in novice.el.gz) is hardcoded to write them to
|
||||||
;; defvaralias, which are done because ensuring aliases are created before
|
;; defvaralias, which are done because ensuring aliases are created before
|
||||||
;; packages are loaded is an unneeded and unhelpful maintenance burden. Emacs
|
;; packages are loaded is an unneeded and unhelpful maintenance burden. Emacs
|
||||||
;; still aliases them fine regardless.
|
;; still aliases them fine regardless.
|
||||||
(with-eval-after-load 'warnings
|
(setq warning-suppress-types '(defvaralias))
|
||||||
(add-to-list 'warning-suppress-types '(defvaralias)))
|
|
||||||
|
|
||||||
;; Reduce debug output unless we've asked for it.
|
;; Reduce debug output unless we've asked for it.
|
||||||
(setq debug-on-error init-file-debug
|
(setq debug-on-error init-file-debug
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue