Major performance improvements, made lazy loading false by default #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By using the lazy package manager's built in features, I have improved the start-up time from ~200ms to ~17ms (on my machine). This was achieved by loading plugins either lazily or by tweaking the plugin load order. The changes are commented and explained in the code, but just to explain briefly:
The
cmd
option only loads a plugin when a certain command is entered, not on start-up.The
event
option only loads plugins when certain events in neovim's event loop are triggered.The
keys
option allows you to set keymaps that actually load the plugin itself. For example, telescope is not loaded until the user executes a telescope key command. The end user doesn't notice this, and not loading a major plugin largely improves performance.The only other change made was to make lazy loading off by default. In the config, I noticed a lot of
lazy = false
. Lazy has an option to specify the default state of lazy loading, which I have switched off by default in theinit.lua
. No longer do you need to specify when lazy loading should be false, only when it's true.I have documented all options with comments, in hopes that anyone with the config can easily understand or have a point of reference if they are wondering what the line of code does. If anyone has any questions about these changes, feel free to let me know.👍