(Emacs)+recursive powers of 1024 to set gc-threshold

Nice function, deterministic, uses a minimal amount of time to compute.
This commit is contained in:
2022-09-14 00:40:14 +01:00
parent 61f06ef0c8
commit a68e59b1b5

View File

@@ -101,7 +101,14 @@
(require 'org)
(require 'eglot))
(setq gc-cons-threshold 100000000)
(defun --powers-of-1024 (n start)
(if (= n 0)
start
(--powers-of-1024 (- n 1) (* 1024 start))))
(let ((mebibyte (--powers-of-1024 2 1)))
(setq gc-cons-threshold (* 100 membibyte) ; ~100MiB
read-process-output-max (* 5 mebibyte))) ; ~5MiB
(provide 'init)
;;; init.el ends here