(Emacs/config|init)~heavily optimised startup time

Used esup to figure out some points of pain, then fixed them.  Also
set gc-cons-threshold at start of init.el really high, then reset
after finished loading.
This commit is contained in:
2023-10-16 08:41:17 +01:00
parent 3145c66a48
commit af191e7de8
2 changed files with 15 additions and 3 deletions

View File

@@ -1195,6 +1195,7 @@ copy pasted the majority of this, tweaking it till it felt good. Doom
Emacs was very helpful here. Emacs was very helpful here.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org (use-package org
:defer t
:init :init
(setq org-edit-src-content-indentation 0 (setq org-edit-src-content-indentation 0
org-goto-interface 'outline org-goto-interface 'outline
@@ -1553,6 +1554,7 @@ execution. I don't use SQL currently but whenever I need it it's
there. there.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package sql (use-package sql
:defer t
:straight nil :straight nil
:init :init
(setq sql-display-sqli-buffer-function nil)) (setq sql-display-sqli-buffer-function nil))
@@ -1760,6 +1762,7 @@ execution of d-mode blocks and alias ~D-mode~ with ~d-mode~.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package d-mode (use-package d-mode
:defer t
:straight t :straight t
:config :config
(fset 'D-mode 'd-mode) (fset 'D-mode 'd-mode)
@@ -2003,6 +2006,7 @@ Emmet for super speed code writing.
*** HTML Auto insert *** HTML Auto insert
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package web-mode (use-package web-mode
:defer t
:auto-insert :auto-insert
(("\\.html\\'" . "HTML Skeleton") (("\\.html\\'" . "HTML Skeleton")
"" ""

View File

@@ -22,6 +22,11 @@
;; Sets up straight, use package and the literate system. ;; Sets up straight, use package and the literate system.
;;; Code: ;;; Code:
;; Before doing anything else, make gc-cons-threshold ridiculously
;; high. This makes it so we have as few pauses during init as
;; possible.
(setq gc-cons-threshold (* 1024 1024 1024)) ; ~1GiB
;; Straight ;; Straight
(defvar bootstrap-version) (defvar bootstrap-version)
(let ((bootstrap-file (let ((bootstrap-file
@@ -36,7 +41,6 @@
(eval-print-last-sexp))) (eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage)) (load bootstrap-file nil 'nomessage))
(setq straight-disable-native-compile nil (setq straight-disable-native-compile nil
straight-use-package-by-default t straight-use-package-by-default t
use-package-enable-imenu-support t use-package-enable-imenu-support t
@@ -76,8 +80,12 @@
(require 'org) (require 'org)
(require 'eglot)) (require 'eglot))
(setq gc-cons-threshold 104857600 ; ~100MiB (setq gc-cons-threshold (* 100 1024 1024) ; ~100MiB
read-process-output-max 5242880) ; ~5MiB read-process-output-max 5242880 ; ~5MiB
;; FIXME: Problem with memory-report after running Emacs for a
;; bit, causes a Lisp nesting error, so I just set it up really
;; high so it doesn't reach that.
max-lisp-eval-depth 5000)
(provide 'init) (provide 'init)
;;; init.el ends here ;;; init.el ends here