perf: autoloads: remove definition-prefixes & abbreviate paths
Reduces the file size of the autoloads path by ~5%, memory usage by ~7%, and buys around ~30-50ms in startup time.
This commit is contained in:
parent
156fade7e2
commit
2645ed491b
1 changed files with 4 additions and 4 deletions
|
@ -55,7 +55,7 @@ hoist buggy forms into autoloads.")
|
||||||
|
|
||||||
(defun doom-autoloads--cleanup-form (form &optional expand)
|
(defun doom-autoloads--cleanup-form (form &optional expand)
|
||||||
(let ((func (car-safe form)))
|
(let ((func (car-safe form)))
|
||||||
(cond ((memq func '(provide custom-autoload))
|
(cond ((memq func '(provide custom-autoload register-definition-prefixes))
|
||||||
nil)
|
nil)
|
||||||
((and (eq func 'add-to-list)
|
((and (eq func 'add-to-list)
|
||||||
(memq (doom-unquote (cadr form))
|
(memq (doom-unquote (cadr form))
|
||||||
|
@ -91,7 +91,7 @@ hoist buggy forms into autoloads.")
|
||||||
((memq definer '(defun defmacro cl-defun cl-defmacro))
|
((memq definer '(defun defmacro cl-defun cl-defmacro))
|
||||||
(print
|
(print
|
||||||
(if module-enabled-p
|
(if module-enabled-p
|
||||||
(make-autoload form file)
|
(make-autoload form (abbreviate-file-name file))
|
||||||
(seq-let (_ _ arglist &rest body) form
|
(seq-let (_ _ arglist &rest body) form
|
||||||
(if altform
|
(if altform
|
||||||
(read altform)
|
(read altform)
|
||||||
|
@ -146,9 +146,9 @@ hoist buggy forms into autoloads.")
|
||||||
autoload-timestamps ; reduce noise in generated files
|
autoload-timestamps ; reduce noise in generated files
|
||||||
autoload-compute-prefixes
|
autoload-compute-prefixes
|
||||||
;; So `autoload-generate-file-autoloads' knows where to write it
|
;; So `autoload-generate-file-autoloads' knows where to write it
|
||||||
(generated-autoload-load-name (file-name-sans-extension file))
|
|
||||||
(target-buffer (current-buffer))
|
(target-buffer (current-buffer))
|
||||||
(module (doom-module-from-path file))
|
(module (doom-module-from-path file))
|
||||||
|
(generated-autoload-load-name (abbreviate-file-name (file-name-sans-extension file)))
|
||||||
(module-enabled-p (and (doom-module-p (car module) (cdr module))
|
(module-enabled-p (and (doom-module-p (car module) (cdr module))
|
||||||
(doom-file-cookie-p file "if" t))))
|
(doom-file-cookie-p file "if" t))))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
@ -182,7 +182,7 @@ non-nil, treat FILES as pre-generated autoload files instead."
|
||||||
(let ((ppss (save-excursion (syntax-ppss))))
|
(let ((ppss (save-excursion (syntax-ppss))))
|
||||||
(or (nth 3 ppss)
|
(or (nth 3 ppss)
|
||||||
(nth 4 ppss)
|
(nth 4 ppss)
|
||||||
(replace-match (prin1-to-string file) t t)))))
|
(replace-match (prin1-to-string (abbreviate-file-name file)) t t)))))
|
||||||
(let ((load-file-name file)
|
(let ((load-file-name file)
|
||||||
(load-path
|
(load-path
|
||||||
(append (list doom-user-dir)
|
(append (list doom-user-dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue