lewis6991 / impatient.nvim

Improve startup time for Neovim
MIT License
1.19k stars 28 forks source link

No difference in startuptime when profiling with dstein64/vim-startuptime #48

Closed tim-hilt closed 2 years ago

tim-hilt commented 2 years ago

Now, let me prefix this by saying, that I might have misunderstood the aim of this project, or misconfigured something. What I'm seeing is the following:

When I take a look at LuaCacheProfile after consecutive startups after LuaCacheClear, This is the first startup after clearing:

    Resolve                  Load
   12.850ms │           │   36.882ms │           │ Total                                         │
...

and this is after the cache has been built (after second startup):

    Resolve                  Load
    3.816ms │           │    4.391ms │           │ Total                                         │ 
...

So there definitely seems to be a difference between cached and uncached startup. However, I didn't notice any difference in the startuptime, so I installed dstein64/vim-startuptime and took a look at StartupTime in between cached and uncached startups. The result: I'm averaging around 160mS and it doesn't seem to matter if I have a built cache or not.

I've installed impatient via packer. I set up impatient before any other code is run.

Looking at #31, I might lack some information on how to actually set this up or how the plugin works together with packer. Can you help me out here? Or is this simply not how it works?

lewis6991 commented 2 years ago

The fact you're seeing a difference from LuaCacheProfile suggests you have it set up properly.

However, I didn't notice any difference in the startuptime

The difference impatient is providing is around 40ms (less than 1/20th of a second), I don't think you would be able to notice this.

I've never used https://github.com/dstein64/vim-startuptime, but one guess is that it isn't measuring Lua loading properly.

so I installed dstein64/vim-startuptime and took a look at StartupTime in between cached and uncached startups.

How did you do this? Note that https://github.com/dstein64/vim-startuptime runs another Neovim instance inside the one you are running, so it could also be that you're not able to get any non-cached results through it.

Looking at https://github.com/lewis6991/impatient.nvim/issues/31, I might lack some information on how to actually set this up or how the plugin works together with packer. Can you help me out here? Or is this simply not how it works?

That issue is stale now. Since https://github.com/neovim/neovim/pull/17200 was merged, packer_compile.lua can now be automatically cached... if you're running Neovim master. If you're on 0.6.1 then it won't be.

lewis6991 commented 2 years ago

Just ran it myself and saw a significant decrease in startuptime:

image

Looks like most of my time decrease is coming from packer_compiled.lua which runs the majority of require's in my config. I don't think the decrease is due to packer_compiled being cached itself.

tim-hilt commented 2 years ago

You're right! I misinterpreted the output of vim-startuptime. I thought it would reuse the current session. Thanks for looking into it! I Uninstalled impatient and took a look at StartupTime again. The jump wasn't as significant for me (190mS to 160mS), but still, it proves, that it actually has an effect on my startup time.

Thanks for the support and thanks for packaging this up!