Move startup optimizations into init.el

Doesn't really belong in core.el and only applies to interactive
sessions.
This commit is contained in:
Henrik Lissner 2018-06-15 14:10:06 +02:00
parent 7b1db08ea2
commit bbda434365
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 35 additions and 26 deletions

View file

@ -112,32 +112,6 @@ else (except for `window-setup-hook').")
(defvar doom--stage 'init)
;;
;; Optimize startup
;;
(defvar doom--file-name-handler-alist file-name-handler-alist)
(unless (or after-init-time noninteractive)
;; A big contributor to long startup times is the garbage collector, so we up
;; its memory threshold, temporarily and reset it later in `doom|finalize'.
(setq gc-cons-threshold 402653184
gc-cons-percentage 1.0
;; consulted on every `require', `load' and various file reading
;; functions. You get a minor speed up by nooping this.
file-name-handler-alist nil))
(defun doom|finalize ()
"Resets garbage collection settings to reasonable defaults (if you don't do
this, you'll get stuttering and random freezes) and resets
`file-name-handler-alist'."
(setq file-name-handler-alist doom--file-name-handler-alist
gc-cons-threshold 16777216
gc-cons-percentage 0.2))
(add-hook 'emacs-startup-hook #'doom|finalize)
(add-hook 'doom-reload-hook #'doom|finalize)
;;
;; Emacs core configuration
;;