I am seeing some slowness in my init file loading:
$ time emacs --debug-init -eval '(kill-emacs)' -Q
real 0m0.672s
user 0m0.338s
sys 0m0.057s
$ time emacs --debug-init --eval '(kill-emacs)'
real 4m17.821s
user 0m2.769s
sys 0m0.226s
These 4mins of loading is reproducible. Actually looks like a timeout. It happens when I do (require 'magit)
. But I don't think it's related to magit because (require 'helm-gtags)
causes the same slowness.
However --debug-init
is not activated when I press C-g during the time emacs is unresponsive. Obviously is not activated either after the load finishes because there's no error.
I am wondering how I can understand where the slowness comes from. I guess a backtrace at the point of slowness would be nice. Maybe some tracing facility?
(setq debug-on-quit t)
at the top of your init file and hitC-g
again when starting Emacs.C-z
at the GDB prompt to inspect the current state. There is a description in this answer.magit.el
. Orhelm-gtags.el
. IOW, narrow the problem to some actual, small bit of code. Then post here what you find, if the solution is not obvious at that point.(setq tramp-ssh-controlmaster-options "")
at the beginning of your config and try again. If loading is fast now then read lists.gnu.org/archive/html/bug-gnu-emacs/2015-03/msg00389.html “I am wondering how I can understand where the slowness comes from.” You can usestrace
tool with e.g. “-T” flag to show the execution time of each system call -16603 read(10, "ssh: connect to host host.does.not.exist port 22: Connection timed out\r\n", 16312) = 72 <18.558404>