Add minimal-emacs-optimize-startup-gc
This commit is contained in:
@@ -38,6 +38,11 @@ turned on.")
|
||||
(defvar minimal-emacs-gc-cons-threshold (* 16 1024 1024)
|
||||
"The value of `gc-cons-threshold' after Emacs startup.")
|
||||
|
||||
(defvar minimal-emacs-optimize-startup-gc t
|
||||
"If non-nil, increase `gc-cons-threshold' during startup to reduce pauses.
|
||||
After Emacs finishes loading, `gc-cons-threshold' is restored to the value
|
||||
stored in `minimal-emacs--restore-gc-cons-threshold'.")
|
||||
|
||||
(defvar minimal-emacs-package-initialize-and-refresh t
|
||||
"Whether to automatically initialize and refresh packages.
|
||||
When set to non-nil, Emacs will automatically call `package-initialize' and
|
||||
@@ -87,12 +92,13 @@ minimalistic appearance during startup.")
|
||||
;; Garbage collection significantly affects startup times. This setting delays
|
||||
;; garbage collection during startup but will be reset later.
|
||||
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
(when minimal-emacs-optimize-startup-gc
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
|
||||
(defun minimal-emacs--restore-gc-cons-threshold ()
|
||||
"Restore `minimal-emacs-gc-cons-threshold'."
|
||||
(setq gc-cons-threshold minimal-emacs-gc-cons-threshold))
|
||||
(add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc-cons-threshold 105)
|
||||
(defun minimal-emacs--restore-gc-cons-threshold ()
|
||||
"Restore `minimal-emacs-gc-cons-threshold'."
|
||||
(setq gc-cons-threshold minimal-emacs-gc-cons-threshold))
|
||||
(add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc-cons-threshold 105))
|
||||
|
||||
;;; Misc
|
||||
|
||||
|
||||
4
init.el
4
init.el
@@ -94,9 +94,7 @@
|
||||
(setq whitespace-line-column nil) ; whitespace-mode
|
||||
|
||||
;; I reduced the default value of 9 to simplify the font-lock keyword,
|
||||
;; aiming to improve performance. This package helps differentiate
|
||||
;; nested delimiter pairs, particularly in languages with heavy use of
|
||||
;; parentheses.
|
||||
;; aiming to improve performance.
|
||||
(setq rainbow-delimiters-max-face-count 5)
|
||||
|
||||
;; Can be activated with `display-line-numbers-mode'
|
||||
|
||||
Reference in New Issue
Block a user