Run emacs garbage collection when idle.

This is to hopefully avoid running garbage collection while I am actively interacting with emacs, which should theoretically result in a smoother experience.
main
Tom Alexander 4 months ago
parent 574a2d0ce7
commit ed7d4ab4e6
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

@ -1,6 +1,6 @@
(setq gc-cons-threshold 100000000) ;; Increase garbage collection threshold for performance (default 800000)
(setq gc-cons-threshold (* 128 1024 1024)) ;; Increase garbage collection threshold for performance (default 800000)
;; Increase amount of data read from processes, default 4k
(when (>= emacs-major-version 27)
(when (version<= "27.0" emacs-version)
(setq read-process-output-max (* 1024 1024)) ;; 1mb
)

@ -36,6 +36,8 @@
;; Don't pop up a small window at the bottom of emacs at launch.
inhibit-startup-screen t
inhibit-startup-message t
;; Don't show the list of buffers when opening many files.
inhibit-startup-buffer-menu t
;; Give the scratch buffer a clean slate.
initial-major-mode 'fundamental-mode
initial-scratch-message nil
@ -81,4 +83,12 @@
(setopt auto-revert-check-vc-info t)
(global-auto-revert-mode)
;;;;; Performance
;; Run garbage collect when emacs is idle
(run-with-idle-timer 5 t (lambda () (garbage-collect)))
(add-function :after after-focus-change-function
(lambda ()
(unless (frame-focus-state)
(garbage-collect))))
(provide 'base)

@ -38,6 +38,7 @@
:hook (eglot-managed-mode . company-mode)
:config
(setq company-backends '((company-capf)))
(setq company-idle-delay 0) ;; Default 0.2
)
;; (use-package company-box

@ -18,5 +18,6 @@
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
}
},
"black-formatter.importStrategy": "fromEnvironment"
}

Loading…
Cancel
Save