diff --git a/core/core.el b/core/core.el index 68422c0fe..bddab71ce 100644 --- a/core/core.el +++ b/core/core.el @@ -307,14 +307,14 @@ users).") ;; Adopt a sneaky garbage collection strategy of waiting until idle time to ;; collect; staving off the collector while the user is working. (when doom-interactive-mode - (setq gc-cons-percentage 0.6) + (setq gcmh-idle-delay 5 + gcmh-high-cons-threshold 16777216 ; 16mb + gcmh-verbose doom-debug-mode + gc-cons-percentage 0.6) (add-transient-hook! 'pre-command-hook (gcmh-mode +1)) (with-eval-after-load 'gcmh - (setq gcmh-idle-delay 10 - gcmh-high-cons-threshold 16777216 - gcmh-verbose doom-debug-mode ; 16mb - gc-cons-percentage 0.1) - (add-hook 'focus-out-hook #'gcmh-idle-garbage-collect))) + (setq gc-cons-percentage 0.1) + (add-hook 'focus-out-hook #'gcmh-idle-garbage-collect)) ;; HACK `tty-run-terminal-initialization' is *tremendously* slow for some ;; reason. Disabling it completely could have many side-effects, so we diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 44482e8f5..e685b74bb 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -462,6 +462,12 @@ relative to `org-directory', unless it is an absolute path." ;; Open directory links in dired (add-to-list 'org-file-apps '(directory . emacs)) + ;; HACK Org is known to use a lot of unicode symbols (and large org files tend + ;; to be especially memory hungry). Compounded with + ;; `inhibit-compacting-font-caches' being non-nil, org needs more memory + ;; to be performant. + (setq-hook! 'org-mode-hook gcmh-high-cons-threshold (* 2 gcmh-high-cons-threshold)) + ;; When you create a sparse tree and `org-indent-mode' is enabled, the ;; highlighting destroys the invisibility added by `org-indent-mode'. ;; Therefore, don't highlight when creating a sparse tree. diff --git a/modules/tools/lsp/config.el b/modules/tools/lsp/config.el index 51f18346e..d6a432146 100644 --- a/modules/tools/lsp/config.el +++ b/modules/tools/lsp/config.el @@ -91,6 +91,10 @@ This also logs the resolved project root, if found, so we know where we are." ;; development builds of Emacs 27 and above (or (not (boundp 'read-process-output-max)) (setq-local read-process-output-max (* 1024 1024))) + ;; REVIEW LSP causes a lot of allocations, with or without Emacs 27+'s + ;; native JSON library, so we up the GC threshold to stave off + ;; GC-induced slowdowns/freezes. + (setq-local gcmh-high-cons-threshold (* 2 gcmh-high-cons-threshold)) (prog1 (lsp-mode 1) (setq-local lsp-buffer-uri (lsp--buffer-uri)) ;; Announce what project root we're using, for diagnostic purposes