perf: native-comp: use 1/4 of your cores instead of 1/2
The sudden spike in CPU and memory utilization alarms people, so I've reduced how many cores native-comp will use. In non-interactive sessions, it will use all of them, however (that is, when I later introduce an AOT switch). You can still override this by setting native-comp-async-jobs-number or comp-num-cpus yourself. I use advice instead of setting comp-num-cpus so that users to avoid trampling on default behavior, or attempts by the user to change them.
This commit is contained in:
parent
0694be43ee
commit
51a9745f38
1 changed files with 12 additions and 1 deletions
13
lisp/doom.el
13
lisp/doom.el
|
@ -490,7 +490,18 @@ Otherwise, `en/disable-command' (in novice.el.gz) is hardcoded to write them to
|
||||||
;; UX: Suppress compiler warnings and don't inundate users with their popups.
|
;; UX: Suppress compiler warnings and don't inundate users with their popups.
|
||||||
;; They are rarely more than warnings, so are safe to ignore.
|
;; They are rarely more than warnings, so are safe to ignore.
|
||||||
(setq native-comp-async-report-warnings-errors init-file-debug
|
(setq native-comp-async-report-warnings-errors init-file-debug
|
||||||
native-comp-warning-on-missing-source init-file-debug))
|
native-comp-warning-on-missing-source init-file-debug)
|
||||||
|
|
||||||
|
;; UX: By default, native-comp uses 100% of half your cores. If you're
|
||||||
|
;; expecting this this should be no issue, but the sudden (and silent) spike
|
||||||
|
;; of CPU and memory utilization can alarm folks, overheat laptops, or
|
||||||
|
;; overwhelm less performant systems.
|
||||||
|
(define-advice comp-effective-async-max-jobs (:before (&rest _) set-default-cpus)
|
||||||
|
"Default to 1/4 of cores in interactive sessions and all of them otherwise."
|
||||||
|
(and (null comp-num-cpus)
|
||||||
|
(zerop native-comp-async-jobs-number)
|
||||||
|
(setq comp-num-cpus
|
||||||
|
(max 1 (/ (num-processors) (if noninteractive 1 4)))))))
|
||||||
|
|
||||||
;;; Suppress package.el
|
;;; Suppress package.el
|
||||||
;; Since Emacs 27, package initialization occurs before `user-init-file' is
|
;; Since Emacs 27, package initialization occurs before `user-init-file' is
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue