tweak: disable ahead-of-time native compilation
Rather than impose a 10-45min compilation step on users, I've disabled ahead-of-time compilation for deferred compilation. In exchange, it will eat up some CPU time the first time each uncompiled package is loaded, but as this happens asynchronously (and are then quietly loaded in the background), I think this is acceptable. An --aot switch (or similar) will be added to `doom sync` and `doom build` in the future, in case folks prefer the old behavior.
This commit is contained in:
parent
b7f84bdd01
commit
3853dff5e1
2 changed files with 22 additions and 5 deletions
|
@ -97,6 +97,16 @@ uses a straight or package.el command directly).")
|
|||
straight-vc-git-default-clone-depth '(1 single-branch))
|
||||
|
||||
(with-eval-after-load 'straight
|
||||
;; HACK Doom relies on deferred compilation, which spares the user 20-50min of
|
||||
;; compilation at install time, but subjects them to ~50% CPU activity when
|
||||
;; starting Emacs for the first time. To complete this, straight.el needs to
|
||||
;; be told not to do native-compilation, but it won't obey
|
||||
;; `straight-disable-native-compile'.
|
||||
;;
|
||||
;; It *will* obey `straight--native-comp-available', though. Trouble is:
|
||||
;; it's a constant; it resets itself when straight is loaded, so it must be
|
||||
;; changed afterwards.
|
||||
(setq straight--native-comp-available nil)
|
||||
;; `let-alist' is built into Emacs 26 and onwards
|
||||
(add-to-list 'straight-built-in-pseudo-packages 'let-alist))
|
||||
|
||||
|
|
17
lisp/doom.el
17
lisp/doom.el
|
@ -59,11 +59,6 @@
|
|||
(unless (get var 'initial-value)
|
||||
(put var 'initial-value (default-value var))))
|
||||
|
||||
;; Prevent unwanted runtime compilation for gccemacs (native-comp) users;
|
||||
;; packages are compiled ahead-of-time when they are installed and site files
|
||||
;; are compiled when gccemacs is installed.
|
||||
(setq native-comp-deferred-compilation nil)
|
||||
|
||||
;; Since Emacs 27, package initialization occurs before `user-init-file' is
|
||||
;; loaded, but after `early-init-file'. Doom handles package initialization, so
|
||||
;; we must prevent Emacs from doing it again.
|
||||
|
@ -316,6 +311,18 @@ users).")
|
|||
;;; Native Compilation support (http://akrl.sdf.org/gccemacs.html)
|
||||
|
||||
(when (featurep 'native-compile)
|
||||
;; Enable deferred compilation and disable ahead-of-time compilation, so we
|
||||
;; don't bog down the install process with an excruciatingly long compile
|
||||
;; times. It will mean more CPU time at runtime, but given its asynchronosity,
|
||||
;; this is acceptable.
|
||||
(setq native-comp-deferred-compilation t
|
||||
straight-disable-native-compile t)
|
||||
|
||||
;; Suppress compiler warnings, to avoid inundating users will popups. They
|
||||
;; don't cause breakage, so it's not worth dedicating screen estate to them.
|
||||
(setq native-comp-async-report-warnings-errors init-file-debug
|
||||
native-comp-warning-on-missing-source init-file-debug)
|
||||
|
||||
;; Don't store eln files in ~/.emacs.d/eln-cache (where they can easily be
|
||||
;; deleted by 'doom upgrade').
|
||||
;; REVIEW Use `startup-redirect-eln-cache' when 28 support is dropped
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue