M-x emacs-init-time is 1.6s, but benchmark-init/root is 899ms
z-ji opened this issue · comments
The emacs internal data of initial time is logger than benchmark.I guess something cause it.
I have used the
;; time the loading of the .emacs ;; keep this on top of your .emacs (defvar *emacs-load-start* (current-time)) (defun anarcat/time-to-ms (time) (+ (* (+ (* (car time) (expt 2 16)) (car (cdr time))) 1000000) (car (cdr (cdr time))))) (defun anarcat/display-timing () (message ".emacs loaded in %fms" (/ (- (anarcat/time-to-ms (current-time)) (anarcat/time-to-ms *emacs-load-start*)) 1000000.0))) (add-hook 'after-init-hook 'anarcat/display-timing t)
which from http://www.emacswiki.org/emacs/OptimizingEmacsStartup
The result is very close to emacs-init-time and more precise.
Could benchmark-init be colser to emacs-init-time, and tell us what happend between the 1600ms-899ms?
I can see if I can implement something like that. In the meantime you can modify your setup so that you load benchmark-init
from the after-init-hook
instead, that way it will only measure events happening from that point on.
@byboating I think I misunderstood you originally. I've tried using the configuration from your GitHub repository now with benchmark-init
and the functions you posted. The difference is that benchmark-init
only measures time spent in require
and load
but the simpler measurement function from EmacsWiki will measure all time spent between two points which will also include anything that is not part of a require
or load
.
If you really want to benchmark all time from Emacs startup you can use the built-in profiler: https://www.gnu.org/software/emacs/manual/html_node/elisp/Profiling.html
I'm closing the issue now but please reopen if you think that I've misunderstood the problem.,