purcell/emacs.d

startup time of 6.9 sec, how can I setup lazy loading

wereket opened this issue · 7 comments

Hello
How could reduce the startup time with lazy loading ?

This configuration is already lazily loaded, and normally shouldn't take that long to start. However, the default is to use desktop-save-mode, which causes buffers to be restored after a restart, and that can lead to slower startup times. Probably you just want to disable that, but I personally find it a better default. Take a look at init-sessions.el.

@purcell

I also notice the same issue. On my MacBook Pro 2019 , it take about 6s to startup.
And the report with sanityinc/require-time show this:

 nixos-options                              2576.291
 init-exec-path                             380.430
 init-elpa                                  377.706
 tablist-filter                             324.063
 semantic/wisent/comp                       302.622
 semantic/wisent                            277.143
 semantic                                   222.996
 lisp-mnt                                   219.302
 mail-parse                                 189.951
 etags                                      137.407
 init-gui-frames                            134.873
 semantic/tag                               119.670
 package-lint                               113.323
 compile                                    106.392
 rfc2231                                    103.094

It is cause by the nixos-options

@wereket Cool, I'll stick with this one though. 😂

@Eason0210 Thanks for checking require-times: yeah, I see the same behaviour. The company backend for nixos options is loaded, and then that causes nixos-options.el to be initialized, which runs a ~2s shell command. I'll probably just drop that backend, or only register it after nix-mode has been loaded.

@purcell

Only register it after nix-mode has been loaded would be a good option.
I also using nix on Mac, and nixos-options.el works well recently.

Done. Now, with an empty session (no buffers) to restore:

init completed in 1674.07ms

which I think is pretty reasonable.

P.S. @wereket I also just encountered and fixed the gitconfig-mode issue: that was due to some packages being removed and republished under a different name upstream.