0

I'm using Vim primarily for rails projects, and have found a fairly significant difference in the start up time between a couple of my projects.

Here's one project's startuptime log, while opening a single .rb file:

185.767  002.679  002.679: sourcing /usr/share/vim/vim81/syntax/ruby.vim          
190.811  004.781  004.781: sourcing /home/thomas/.vim/bundle/vim-rails/autoload/rails.vim
478.080  000.275  000.275: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions.vim
478.257  000.061  000.061: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/quickfix.vim
478.484  000.156  000.156: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline.vim
478.645  000.035  000.035: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/netrw.vim
478.782  000.024  000.024: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/term.vim
478.944  000.059  000.059: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/ctrlp.vim
479.145  000.069  000.069: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/hunks.vim
479.471  000.120  000.120: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/whitespace.vim
479.853  000.054  000.054: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/po.vim
480.050  000.089  000.089: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/wordcount.vim
480.242  000.024  000.024: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/keymap.vim
482.185  000.073  000.073: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/section.vim
482.524  000.188  000.188: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/highlighter.vim
484.883  000.101  000.101: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/themes.vim
486.300  001.637  001.536: sourcing /home/thomas/.vim/bundle/gruvbox/autoload/airline/themes/gruvbox.vim
504.566  000.141  000.141: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/builder.vim
504.970  000.089  000.089: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/default.vim
576.879  389.599: opening buffers                                                 
577.160  000.126  000.126: sourcing /home/thomas/.vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vimode

Note the big jump in clock after vim-rails, but unless I'm being dumb the self+sourced & self times are in ms right? So the clock appears to jump but without a corresponding 300ms time. Then, further down, 'opening buffers' appears to maybe account for that 300ms?

The other project is far, far worse - again, opening a single .rb file:

181.187  004.675  004.675: sourcing /home/thomas/.vim/bundle/vim-rails/autoload/rails.vim
4782.456  000.270  000.270: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions.vim
4782.607  000.053  000.053: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/quickfix.vim
4782.829  000.148  000.148: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline.vim
4782.985  000.035  000.035: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/netrw.vim
4783.113  000.024  000.024: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/term.vim
4783.280  000.059  000.059: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/ctrlp.vim
4783.479  000.070  000.070: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/hunks.vim
4783.797  000.114  000.114: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/whitespace.vim
4784.180  000.056  000.056: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/po.vim
4784.399  000.095  000.095: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/wordcount.vim
4784.598  000.026  000.026: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/keymap.vim
4786.604  000.072  000.072: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/section.vim
4786.961  000.204  000.204: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/highlighter.vim
4789.168  000.047  000.047: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/themes.vim
4790.483  001.470  001.423: sourcing /home/thomas/.vim/bundle/gruvbox/autoload/airline/themes/gruvbox.vim
4809.004  000.138  000.138: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/builder.vim
4809.359  000.078  000.078: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/default.vim
4867.585  4686.103: opening buffers                                               
4867.862  000.126  000.126: sourcing /home/thomas/.vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim

same deal - the elapsed times don't seem to match the clock time. Looking at what's going on with the clock time it seems like vim-rails could be the culprit, but disabling it doesn't do the job, the apparent 5s jump is now at 'opening buffers':

177.576  000.045  000.045: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/themes.vim
178.888  001.464  001.419: sourcing /home/thomas/.vim/bundle/gruvbox/autoload/airline/themes/gruvbox.vim
202.604  000.145  000.145: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/builder.vim
202.975  000.074  000.074: sourcing /home/thomas/.vim/bundle/vim-airline/autoload/airline/extensions/default.vim
5496.540  5327.812: opening buffers        

vim -u NONE on the same files loads blazing fast, with no particular difference between the projects, as you'd expect.

I am using the following plugins:

ctrlp.vim/                 gruvbox/                  vim-bundler/        vim-pug/       vim-vue/
DeleteTrailingWhitespace/  ShowTrailingWhitespace~/  vim-coffee-script/  vim-rails/
delimitMate/               typescript-vim/           vim-endwise/        vim-slim/
emmet-vim/                 vim-airline/              vim-indent-guides/  vim-surround/

with Pathogen.

What's the next step in debugging this?

  • 1
    Please provide more information: Are you reloading buffers? (e.g. from a session or loading several buffers from the commandline)? Is accessing those buffers/files slow on your filesystem (e.g. NFS/network share or similar)? Could it be a anti-virus scanner intercepting loading the buffers? What other plugins are you using? – Christian Brabandt Nov 13 '18 at 12:53
  • I've updated the original question. In all cases I'm opening a single buffer from the command line. Opening the same buffers with -u NONE is lightning fast. No AV. Have added a paste of my bundle directory. – ttrmw Nov 13 '18 at 14:34
  • Next step would be debug if a plugin or your personal .vimrc makes it slow. See the faq – Christian Brabandt Nov 13 '18 at 14:38
0

Okay, so the startup log wasn't actually very helpful here. There wasn't really any indication in the log that this was the culprit, but it turns out it was vim-bundler.

I actually didn't even paste the line for it, because its timestamps seemed so inconsequential, but:

 20 048.261  001.317  001.317: sourcing /home/thomas/.vim/bundle/vim-bundler/plugin/bundler.vim

I had this plugin at 48abb77. upgrading to a996611 has dramatically sped up my startup time in all rails projects.

My approach for figuring this out was just to start with a fresh .vim/bundle and reintroduce each plugin one at a time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.