diff --git a/core/core-editor.el b/core/core-editor.el index 41d64ffe6..d1f9a78b7 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -426,11 +426,20 @@ files, so we replace calls to `pp' with the much faster `prin1'." undo-tree-history-directory-alist `(("." . ,(concat doom-cache-dir "undo-tree-hist/")))) + ;; Compress undo-tree history files with zstd, if available. File size isn't + ;; the (only) concern here: the file IO barrier is slow for Emacs to cross; + ;; reading a tiny file and piping it in-memory through zstd is *slightly* + ;; faster than Emacs reading the entire undo-tree file from the get go (on + ;; SSDs). Whether or not that's true in practice, we still enjoy zstd's ~80% + ;; file savings (these files add up over time and zstd is so incredibly fast). (when (executable-find "zstd") (defadvice! doom--undo-tree-make-history-save-file-name-a (file) :filter-return #'undo-tree-make-history-save-file-name (concat file ".zst"))) + ;; Strip text properties from undo-tree data to stave off bloat. File size + ;; isn't the concern here; undo cache files bloat easily, which can cause + ;; freezing, crashes, GC-induced stuttering or delays when opening files. (defadvice! doom--undo-tree-strip-text-properties-a (&rest _) :before #'undo-list-transfer-to-tree (dolist (item buffer-undo-list)