I’ve been looking for methods to improve Emacs performance especially with my configuration being over >3k. I’m not particularly interested in startup-time since I never close Emacs. Here’s what I found so far
(setq package-native-compile t
gcmh-high-cons-threshold 100000000
gc-cons-threshold 100000000
scroll-conservatively 101
jit-lock-defer-time 0
large-file-warning-threshold nil)
(add-hook 'after-init-hook #'(lambda () (setq gc-cons-threshold (* 100 1000 1000))))
(defvar gc-timer nil)
(defun salih/maybe-gc ()
(let ((original gc-cons-threshold))
(setq gc-cons-threshold 800000)
(setq gc-cons-threshold original
gc-timer (run-with-timer 2 nil #'salih/schedule-maybe-gc))))
(defun salih/schedule-maybe-gc ()
(setq gc-timer (run-with-idle-timer 2 nil #'salih/maybe-gc)))
(salih/schedule-maybe-gc)
I can tell that I’ve noticed some improvements.
Define fast. Speed is relative. Your fast and my fast may not be the same. But my answer is lazy load everything.
If not in startup, what performance deficits and improvements have you noticed? How do you measure or notice the improvements?
> I can tell that I’ve noticed some improvements.
I can tell this claim is worthless without data.
For me, the main issue was startup speed from my customizations. This I sped up by:
- Making use of
emacsclient
over new emacs sessions. - Combining scattered customization files into a single large
emacs.el
file. - Use
defvar
andautoload
overrequire
,load
,eval-after-load
.
The last one is mostly to allow compiler- and flycheck warnings to work, without prematurely loading dependencies of my customization code.
switch to neovim