You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I switched from [lazy.nvim] to `vim.pack`, I lost the ability to
lazily load plugins behind events of key bindings. I profiled the
behavior with `nvim --startuptime` and it seemed okay.
When I loaded up the changes on a computer with a much larger directory
with a much larger file history, I could tell that the startup was
noticeably slower. According to `nvim --startuptime`, it took 3.5
*seconds* to load.
The biggest offender was calculating the stats about plugins for my
dashboard. Removing this took off about 3 seconds by itself. While it
was nice to have, I honestly never paid any attention to it.
After this I began moving plugins behind events. I'd originally used
`vim.schedule` because I (wrongly) thought this would run the callback
_after_ startup. It turns out it runs the callback more or less after
the current event's callbacks are done. There are a few instances where
I took advantage of this by using `vim.schedule` instead of callback.
This all became enough of a pattern that I added a `load_on` helper.
Finally, because I was already well down the rabbit hole, I learned that
enabling spellcheck was taking about 10 milliseconds. I decided to drop
this, too, behind an event.
All of these changes together helped me reduce the 3.5 second startup
time to 45 milliseconds. I'm sure I'll discover things that don't work
quite right or don't load early enough, but we'll see how it goes as I
use it.
0 commit comments