From 024048dd5e39fa41f0d02146d184f314c5fcd8a9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 20 Sep 2022 01:43:33 +0200 Subject: [PATCH] perf: disable autoload-compute-prefixes & optimize var cache - Batch more variables in Doom's autoloads files. - Remove all the register-definition-prefixes calls generated in autoloads files (for both modules' and packages' autoloads). These don't serve much purpose, and only incur added cost growing a large hash table. --- lisp/cli/packages.el | 5 +++++ lisp/doom-profiles.el | 4 ---- lisp/lib/autoloads.el | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lisp/cli/packages.el b/lisp/cli/packages.el index 039d58ab6..c7bc55776 100644 --- a/lisp/cli/packages.el +++ b/lisp/cli/packages.el @@ -722,6 +722,11 @@ original state.") if (string-match-p prompt-re prompt) return (string-match-p opt-re option))) +(defadvice! doom-cli--straight-no-compute-prefixes-a (fn &rest args) + :around #'straight--build-autoloads + (let (autoload-compute-prefixes) + (apply fn args))) + (defadvice! doom-cli--straight-fallback-to-tty-prompt-a (fn prompt actions) "Modifies straight to prompt on the terminal when in noninteractive sessions." :around #'straight--popup-raw diff --git a/lisp/doom-profiles.el b/lisp/doom-profiles.el index fd1e06f43..e4c79d650 100644 --- a/lisp/doom-profiles.el +++ b/lisp/doom-profiles.el @@ -362,10 +362,6 @@ Defaults to the profile at `doom-profile-default'." (signal 'doom-autoload-error (list init-file e)))))) (defun doom-profile--generate-init-vars () - (setq doom-autoloads-cached-vars '(load-path - Info-directory-list - auto-mode-alist - interpreter-mode-alist)) (let ((v (version-to-list doom-version)) (ref (doom-call-process "git" "-C" (doom-path doom-emacs-dir) "rev-parse" "HEAD")) (branch (doom-call-process "git" "-C" (doom-path doom-emacs-dir) "branch" "--show-current"))) diff --git a/lisp/lib/autoloads.el b/lisp/lib/autoloads.el index 7dfc17fff..a5a49102d 100644 --- a/lisp/lib/autoloads.el +++ b/lisp/lib/autoloads.el @@ -12,12 +12,11 @@ hoist buggy forms into autoloads.") "List of regexps whose matching files won't be indexed for autoloads.") (defvar doom-autoloads-cached-vars - '(doom-modules - doom-disabled-packages - native-comp-deferred-compilation-deny-list - load-path + '(load-path auto-mode-alist interpreter-mode-alist + magic-mode-alist + magic-fallback-mode-alist Info-directory-list) "A list of variables to be cached in `doom-autoloads-file'.") @@ -145,6 +144,7 @@ hoist buggy forms into autoloads.") (version-control 'never) case-fold-search ; reduce magic autoload-timestamps ; reduce noise in generated files + autoload-compute-prefixes ;; So `autoload-generate-file-autoloads' knows where to write it (generated-autoload-load-name (file-name-sans-extension file)) (target-buffer (current-buffer))