purcell / emacs.d

An Emacs configuration bundle with batteries included
BSD 2-Clause "Simplified" License
6.84k stars 2.05k forks source link

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

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello How could reduce the startup time with lazy loading ?

purcell commented 2 years ago

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.

Eason0210 commented 2 years ago

@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

ghost commented 2 years ago

I finally changed to mathewzmd M-EMACS because reinstalling purcell emacs I had issue with gitignore-mode- I spent 2 hours trying and gave up. M-EMACS startx < 1.8 sec

On Thu, Oct 21, 2021 at 7:21 AM Eason Huang @.***> wrote:

@purcell https://github.com/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:

4101.561 nixos-options 2576.291 648.297 init-exec-path 380.430 270.580 init-elpa 377.706 20773.175 tablist-filter 324.063 20794.281 semantic/wisent/comp 302.622 20817.650 semantic/wisent 277.143 20847.159 semantic 222.996 2919.922 lisp-mnt 219.302 2948.838 mail-parse 189.951 6943.893 etags 137.407 1118.495 init-gui-frames 134.873 20900.269 semantic/tag 119.670 7303.230 package-lint 113.323 2767.458 compile 106.392 3035.639 rfc2231 103.094

It is cause by the nixes-options

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/purcell/emacs.d/issues/793#issuecomment-948512497, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVNNM32LBUCWT2SLIV6DBRDUH7ZSZANCNFSM5GHDSXQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

purcell commented 2 years ago

@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.

Eason0210 commented 2 years ago

@purcell

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

purcell commented 2 years ago

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

init completed in 1674.07ms

which I think is pretty reasonable.

purcell commented 2 years ago

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.