Merge branch 'master' into 'master'

Faster Emacs

See merge request dwt1/dotfiles!39
This commit is contained in:
Derek Taylor
2021-06-08 20:17:26 +00:00
+47
View File
@@ -14,6 +14,9 @@
- [[#use-package][Use-Package]] - [[#use-package][Use-Package]]
- [[#evil-mode][Evil Mode]] - [[#evil-mode][Evil Mode]]
- [[#general-keybindings][General Keybindings]] - [[#general-keybindings][General Keybindings]]
- [[#startup-performance][STARTUP PERFORMANCE]]
- [[#garbage-collection][Garbage collection]]
- [[#native-compil][Native Compil]]
- [[#all-the-icons][ALL THE ICONS]] - [[#all-the-icons][ALL THE ICONS]]
- [[#buffers-and-bookmarks][BUFFERS AND BOOKMARKS]] - [[#buffers-and-bookmarks][BUFFERS AND BOOKMARKS]]
- [[#dashboard][DASHBOARD]] - [[#dashboard][DASHBOARD]]
@@ -66,6 +69,7 @@
- [[#splits-and-window-controls][SPLITS AND WINDOW CONTROLS]] - [[#splits-and-window-controls][SPLITS AND WINDOW CONTROLS]]
- [[#theme][THEME]] - [[#theme][THEME]]
- [[#which-key][WHICH KEY]] - [[#which-key][WHICH KEY]]
- [[#runtime-performance][RUNTIME PERFORMANCE]]
- [[#writeroom-mode][WRITEROOM MODE]] - [[#writeroom-mode][WRITEROOM MODE]]
* IMPORTANT! PUT THIS IN YOUR INIT.EL * IMPORTANT! PUT THIS IN YOUR INIT.EL
@@ -130,6 +134,42 @@ General.el allows us to set keybindings. As a longtime Doom Emacs user, I have
(general-evil-setup t)) (general-evil-setup t))
#+end_src #+end_src
* STARTUP PERFORMANCE
This section is where it make emacs faster to load.
** Garbage collection
Makes startup faster by reducing the frequency of garbage collection
#+begin_src emacs-lisp
;; Using garbage magic hack.
(use-package gcmh
:config
(gcmh-mode 1))
;; Setting garbage collection threshold
(setq gc-cons-threshold 402653184
gc-cons-percentage 0.6)
;; Profile emacs startup
(add-hook 'emacs-startup-hook
(lambda ()
(message "*** Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done)))
;; Silence compiler warnings as they can be pretty disruptive (setq comp-async-report-warnings-errors nil)
#+end_src
** Native Compil
#+begin_src emacs-lisp
;; Silence compiler warnings as they can be pretty disruptive
(if (boundp 'comp-deferred-compilation)
(setq comp-deferred-compilation nil)
(setq native-comp-deferred-compilation nil))
;; In noninteractive sessions, prioritize non-byte-compiled source files to
;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time
;; to skip the mtime checks on every *.elc file.
(setq load-prefer-newer noninteractive)
#+end_src
* ALL THE ICONS * ALL THE ICONS
This is an icon set that can be used with dashboard, dired, ibuffer and other Emacs programs. This is an icon set that can be used with dashboard, dired, ibuffer and other Emacs programs.
@@ -886,6 +926,13 @@ Which-key is a minor mode for Emacs that displays the key bindings following you
which-key-allow-imprecise-window-fit t which-key-allow-imprecise-window-fit t
which-key-separator "" )) which-key-separator "" ))
(which-key-mode) (which-key-mode)
#+e
* RUNTIME PERFORMANCE
Dial the GC threshold back down so that garbage collection happens more frequently but in less time.
#+begin_src emacs-lisp
;; Make gc pauses faster by decreasing the threshold.
(setq gc-cons-threshold (* 2 1000 1000))
#+end_src #+end_src
* WRITEROOM MODE * WRITEROOM MODE