-
-
Notifications
You must be signed in to change notification settings - Fork 638
feat: allow lazy loading via vim.g.NvimTreeConfig #3229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
NvimTree aims for ~0 startup cost and ~0 setup cost, see wiki Do you have any new information on NvimTree startup or setup times? Has a regression been introduced? The preferable course of action is to resolve any problems as they will affect all users. RE the |
|
There hasn't been any regression that I am aware of, I was just looking at my neovim startup times and nvim-tree was one of the chunkier ones. Just looking for those last 10% optimizations
|
That's no good... we need to fix that. What are the timings? |
|
I am somewhat against special casing as such. Let's fix underlying issue if there is one instead, benefitting everyone. |
|
Here is the relevant section from the output of So about 5msec. Complete load time is about 140msec, so about 3.5%. With the patch in this PR all those calls are deferred. Since I don't always use
Well, in this case I think the pattern in this PR should be encouraged, because it is going to be faster in all cases. Even if Somewhat relevant to this PR, I remembered this article I came across a few years ago: https://mrcjkb.dev/posts/2023-08-22-setup.html |
|
Fast PC: Slow remote server: 7-11 is significant. We are loading almost all modules and classes when executing setup. Without requiring nvim-tree modules or calling setup, we get just this one require, thanks to the great work of @przepompownia on #3210 There is significant scope to improve this by removing unnecessary requires when executing setup. Removing most requires from |
|
I didn't experinence the case described here (at the startup) because of using a simple custom lazy loader which defers calling |
That's really nice - it sidesteps the module loading for both API and setup calls. Looks like the only module loading you get is plugin/commands, and your recent change made that fast. |
That prevents only from loading unnecessary modules (except command defs) before the first use. #3231 can be helpful afterwards. |
|
We have a good understanding of the genuine issue here: there are unnecessary, expensive modules loaded when requiring api and when executing setup. This goes against the ~0 startup cost and ~0 setup cost goal. We know what needs to be done via #3231 which builds on the work already done via #3210 The |
|
@przepompownia interesting, I was working on a very similar approach to your Without hijacking I know you can optimize |
No. Notice the index ( See https://www.lua.org/manual/5.1/manual.html#pdf-package.loaders |
Initially I was interested in using lazy.nvim, but (with all due respect to the author's effort) it is shipped with lots of things I don't need, so I wrote something simple and enough for a few modules. |
|
@przepompownia I just tried to implement a similar functionality to what you have in my repo. My first instinct was to have a table of prefixes and a setup function for each prefix, for example, if the prefix is Edit: by this approach being "risky", do you mean as in a security risk, where someone could hijack the config table to add arbitrary code on |
I was trying to improve my neovim startup time by lazy loading dependencies here, and
nvim-treewas a good candidate to lazy load.I noticed that it would be easy to implement this use case by adding the simple setup call in the
wrapfunction.It seems to work for my usecases but I did not do extensive testing