vim-conda
vim-conda copied to clipboard
Startup speed (on Windows)
The vim-conda
plugin takes way too long to load, 400-500 ms based on --startuptime
timings. The subprocess
calls are surely a big chunk, but we can be smarter in how the work gets done.
I'm also thinking it might be a good idea to have a continuously-running process for querying conda things, rather than starting up a subprocess each time.
Also in Linux it takes a lot of time. Any clue why?
Top 10 plugins slowing vim's startup
====================================
1 31.292 vim-conda
2 25.968 nerdtree
3 17.585 vim-textobj-entire
4 12.444 syntastic
5 10.103 vim-fugitive
6 6.218 vim-airline
7 4.610 vim-unimpaired
8 4.101 vim-gitgutter
9 2.280 python-mode
10 1.260 vim-test
====================================
Yes, it's because of os calls to look up things in the environment and e.g. run conda info commands and parse the output. It should be fairly easy to optimize, but I have no time for it.
I've got a branch that reduces this startup time to about a third of what it is by using a memoize decorator. The big culprit is running conda info --json
, which is needed for default_prefix
and envs
.
I believe that you can get default_prefix
and envs
by looking at the output of which python
instead of asking conda directly, but haven't had a chance to mess with it entirely.
Please advise on whether there's interest in using the memoize solution, or if I should just open a pull request once I have it working with shell tools.
I haven't played with memoize, but the idea is appealing. I'd be happy to test it for you. I use Windows mostly with some WSL Ubuntu; currently using a link from .vim to my vimfiles, so far without problems.
BTW, on Windows which
is spelled where
.
Sorry it took me a while to get back to this: I've got a fork at https://github.com/ryanfreckleton/vim-conda/tree/develop which has the modifications to use a caching system which gives quite good speedup.
Please advise whether there's enough interest for me to put together a pull request.
@ryanfreckleton Sure! I've added you as a collaborator so you have commit rights. You'll prob want to put up a PR anyway to get feedback from the others.
Awesome, thanks! I will :)
Pull-request open at https://github.com/cjrh/vim-conda/pull/24 I'd like at least one other person to look at it and someone to test it on windows before I merge.
Merged. Could someone on windows please test to see if performance increases?
I see a vim-conda.vim load time improvement from 1554 msec to 781 msec on Windows 10 for conda v4.5.1.
Good job.