vim-conda icon indicating copy to clipboard operation
vim-conda copied to clipboard

Startup speed (on Windows)

Open cjrh opened this issue 9 years ago • 10 comments

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.

cjrh avatar Mar 13 '15 03:03 cjrh

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
====================================

Mistobaan avatar Nov 22 '16 21:11 Mistobaan

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.

cjrh avatar Nov 22 '16 21:11 cjrh

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.

ryanfreckleton avatar Dec 01 '17 22:12 ryanfreckleton

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.

jfishe avatar Dec 10 '17 23:12 jfishe

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 avatar Jan 24 '18 22:01 ryanfreckleton

@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.

cjrh avatar Jan 24 '18 23:01 cjrh

Awesome, thanks! I will :)

ryanfreckleton avatar Jan 24 '18 23:01 ryanfreckleton

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.

ryanfreckleton avatar Apr 12 '18 16:04 ryanfreckleton

Merged. Could someone on windows please test to see if performance increases?

ryanfreckleton avatar Apr 12 '18 23:04 ryanfreckleton

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.

jfishe avatar Apr 20 '18 21:04 jfishe