Refactor doom startup benchmark

This commit is contained in:
Henrik Lissner 2018-02-27 22:30:49 -05:00
parent 047ed6c9ea
commit c2fd538261
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 11 additions and 14 deletions

View file

@ -284,14 +284,15 @@ Used by `require!' and `depends-on!'."
'(t)) '(t))
doom-modules))) doom-modules)))
(defun doom-packages--display-benchmark () (defun doom-packages--benchmark ()
(message "Doom loaded %s packages across %d modules in %.03fs" (format "Doom loaded %s packages across %d modules in %.03fs"
;; Certainly imprecise, especially where custom additions to ;; Certainly imprecise, especially where custom additions to
;; load-path are concerned, but I don't mind a [small] margin of ;; load-path are concerned, but I don't mind a [small] margin of
;; error in the plugin count in exchange for faster startup. ;; error in the plugin count in exchange for faster startup.
(length doom-package-load-path) (- (length load-path) (length doom-site-load-path))
(hash-table-size doom-modules) (hash-table-size doom-modules)
(setq doom-init-time (float-time (time-subtract (current-time) before-init-time))))) (or doom-init-time
(setq doom-init-time (float-time (time-subtract (current-time) before-init-time))))))
;; ;;

View file

@ -166,8 +166,7 @@ ability to invoke the debugger in debug mode."
(require 'server) (require 'server)
(unless (server-running-p) (unless (server-running-p)
(server-start))) (server-start)))
(doom-packages--display-benchmark)) (message "%s" (doom-packages--benchmark)))
;; If you forget to reset this, you'll get stuttering and random freezes! ;; If you forget to reset this, you'll get stuttering and random freezes!
(setq gc-cons-threshold 16777216 (setq gc-cons-threshold 16777216
gc-cons-percentage 0.1 gc-cons-percentage 0.1

View file

@ -262,10 +262,7 @@ controlled by `+doom-dashboard-pwd-policy'."
(propertize (propertize
(+doom-dashboard--center (+doom-dashboard--center
+doom-dashboard--width +doom-dashboard--width
(format "Loaded %d packages in %d modules in %.02fs" (doom-packages--benchmark))
(length doom-package-load-path)
(hash-table-size doom-modules)
doom-init-time))
'face 'font-lock-comment-face) 'face 'font-lock-comment-face)
"\n\n")) "\n\n"))