From a68e59b1b5e77d11266430304f1da31a915a82d5 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 14 Sep 2022 00:40:14 +0100 Subject: (Emacs)+recursive powers of 1024 to set gc-threshold Nice function, deterministic, uses a minimal amount of time to compute. --- Emacs/.config/emacs/init.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Emacs/.config/emacs/init.el') diff --git a/Emacs/.config/emacs/init.el b/Emacs/.config/emacs/init.el index 46facd4..f735977 100644 --- a/Emacs/.config/emacs/init.el +++ b/Emacs/.config/emacs/init.el @@ -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 -- cgit v1.2.3-13-gbd6f