From 78d7699645a52bdf0efee7efee3df34f75af8211 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 20 Feb 2021 00:41:12 -0600 Subject: Replace GCMH with a dumber thing that might work as well --- config.org | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/config.org b/config.org index b23420f..180d009 100644 --- a/config.org +++ b/config.org @@ -1299,7 +1299,7 @@ the user is looking at something else. ** Garbage collection -*** Garbage Collection Magic Hack :package: +*** COMMENT Garbage Collection Magic Hack :package: Look, I'm not going to look too deeply into this. It's /magic/ afer all. @@ -1313,6 +1313,31 @@ all. (blackout 'gcmh-mode) #+end_src +*** Simple GC munging about + +From [[https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/][bling]], from ... 2016? Maybe this isn't great, but it's one less package so +I'm going to try it for now. + +#+begin_src emacs-lisp :noweb-ref hooks + (defconst gc-cons-basis (* 800 1000) + "The basis value to which to return after a max jump. + + 800,000 (800 KB) is Emacs' default.") + + (defun hook--gc-cons-maximize () + "Set `gc-cons-threshold' to the highest possible. + For memory-intensive features." + (setq gc-cons-threshold most-positive-fixnum)) + + (defun hook--gc-cons-baseline () + "Return `gc-cons-threshold' to `gc-cons-basis'. + For after memory intensive operations." + (setq gc-cons-threshold gc-cons-basis)) + + (add-hook 'minibuffer-setup-hook #'hook--gc-cons-maximize) + (add-hook 'minibuffer-exit-hook #'hook--gc-cons-baseline) +#+end_src + *** Garbage Collect when out of focus #+begin_src emacs-lisp :noweb-ref hooks -- cgit 1.4.1-21-gabe81