perf(startup): Improve startup speed by borrowing from doom-emacs

Shameless borrow various methods of improving Emacs startup time from
doom-emacs:

b0978a4526/docs/faq.org (how-does-doom-start-up-so-quickly)
This commit is contained in:
2020-02-15 18:10:08 +00:00
parent e703f4ef53
commit e9e65f9d9f
3 changed files with 35 additions and 0 deletions

View File

@@ -36,6 +36,7 @@
;; Continue core stuff
(require 'siren-core-packages)
(require 'siren-core-performance)
(require 'siren-core-env)
(require 'siren-core-ui)
(require 'siren-core-editor)

View File

@@ -0,0 +1,20 @@
;;; siren-core-performance.el --- jimeh's Emacs Siren: Performance tweaks
;;; Commentary:
;; Performance tweaks.
;;; Code:
;; Setup and use gcmh-mode for improved garbage collection.
(use-package gcmh
:hook
(emacs-startup . (lambda() (gcmh-mode +1)))
(focus-out-hook . gcmh-idle-garbage-collect)
:custom
(gcmh-idle-delay 10)
(gcmh-high-cons-threshold 16777216))
(provide 'siren-core-performance)
;;; siren-core-performance.el ends here

View File

@@ -6,8 +6,22 @@
;;; Code:
;; Defer garbage collection further back in the startup process
(setq gc-cons-threshold most-positive-fixnum)
;; Disable Emacs 27's automatic package.el initialization before the init.el
;; file is loaded. I use straight.el instead of package.el.
(setq package-enable-at-startup nil)
;; Prevent the glimpse of un-styled Emacs by disabling these UI elements early.
(setq tool-bar-mode nil
menu-bar-mode nil)
(when (fboundp 'set-scroll-bar-mode)
(set-scroll-bar-mode nil))
;; Resizing the Emacs frame can be a terribly expensive part of changing the
;; font. By inhibiting this, we easily halve startup times with fonts that are
;; larger than the system default.
(setq frame-inhibit-implied-resize t)
;;; early-init.el ends here