summaryrefslogtreecommitdiff
path: root/.config/emacs
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-08-18 00:38:06 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-08-18 00:38:06 +0200
commit8525e85768eae433339a5f933f09baacd8e69640 (patch)
tree0e19004381c6566a85bd90fea2784ce9277ea01f /.config/emacs
parent8d8e5c7ad1db6864e29f7afec7d3c9126bd6ca08 (diff)
emacs: Optimize limit vars
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/config.org21
1 files changed, 18 insertions, 3 deletions
diff --git a/.config/emacs/config.org b/.config/emacs/config.org
index 32f33c1..b66658a 100644
--- a/.config/emacs/config.org
+++ b/.config/emacs/config.org
@@ -102,12 +102,27 @@ directory; let’s throw it all in the cache directory instead.
These are just some limits Emacs abides by as far as garbage-collection and
process communication go. They’re pretty low by default though; any modern
-system is capable of much higher.
+system is capable of much higher. To improve startup performance the garbage
+collection theshold is set to the max until Emacs is initialized. Additionally
+the documentation for ~read-process-output-max~ gives us a hint at how large we
+can set it:
+
+#+BEGIN_QUOTE
+
+ On GNU/Linux systems, the value should not exceed
+ =/proc/sys/fs/pipe-max-size=. See pipe(7) manpage for details.
+
+#+END_QUOTE
#+BEGIN_SRC elisp
- (setq gc-cons-threshold (* 512 1-MiB)
- read-process-output-max 1-MiB)
+ (setq gc-cons-threshold most-positive-fixnum)
+ (add-hook 'after-init-hook
+ (lambda () (setq gc-cons-threshold (* 512 1-MiB))))
+
+ (with-temp-buffer
+ (insert-file-contents "/proc/sys/fs/pipe-max-size")
+ (setq read-process-output-max (number-at-point)))
#+END_SRC