Slow startup #124

Closed
zhaocai opened this Issue Dec 18, 2011 · 9 comments

4 participants

@zhaocai

Hi, guys

I just tried NeoBundle and surprisingly found that neobundle loaded much faster than vundle. As a matter of fact, neobundle was originally based on vundle. The profiling process and command are detailed as below for you reference.

If you are interested, please try it yourself and share the results...

Profiling Command

vim --cmd 'profile start profile.log' \
    --cmd 'profile func *' \
    --cmd 'profile file *' \
    -c 'profdel func *' \
    -c 'profdel file *' \
    -c 'qa!'

vimrc diff

same vimrc containing 50+ bundles. The only difference are a few lines to load vundle or neobundle.

    if has('vim_starting')
    set rtp+=~/.vim/bundle/vundle/
    call vundle#rc()
    let g:vundle_win_width = 36
    endif

    Bundle 'gmarik/vundle'
    if has('vim_starting')
    set runtimepath+=~/.vim/bundle/neobundle.vim/
    call neobundle#rc(expand('~/.vim/bundle/'))
    command! -nargs=+ Bundle
                \ call neobundle#config#bundle(<args>)
    endif

    NeoBundle 'Shougo/neobundle.vim'

testing results

Please check the top lines for each profiling results.

  • vundle
    FUNCTIONS SORTED ON TOTAL TIME
    count  total (s)   self (s)  function
      103   0.942041   0.001915  vundle#config#bundle()
      103   0.494629   0.029297  <SNR>4_rtp_add_a()
      104   0.434962   0.028427  <SNR>4_rtp_rm_a()
     5356   0.345058             <SNR>4_rtp_add()
     5253   0.288478             <SNR>4_rtp_rm()
    10609   0.238331   0.071125  2()
    10609   0.167206   0.055477  1()
    10609   0.111729             <SNR>4_expand_path()
        1   0.065721   0.000963  <SNR>103_browse_check()
        2   0.054499   0.002833  vital#of()
        1   0.042505   0.000064  <SNR>131_SetWatchExtension()
        1   0.042441   0.000061  <SNR>131_CreateDict()
        1   0.042380   0.011695  <SNR>131_ParseFileAssociationList()
        1   0.041924   0.000028  vital#_c7f20e#new()
        2   0.041896   0.000126  <SNR>191_import()
        4   0.034772   0.024908  DoxygenReadTemplates()
        3   0.032555   0.015258  <SNR>191__scripts()
        3   0.029177   0.000403  <SNR>191__import()
       13   0.028053             TagHighlight#LoadDataFile#LoadFile()
        2   0.027475   0.002766  zlib#sys#ostype()

    FUNCTIONS SORTED ON SELF TIME
    count  total (s)   self (s)  function
     5356              0.345058  <SNR>4_rtp_add()
     5253              0.288478  <SNR>4_rtp_rm()
    10609              0.111729  <SNR>4_expand_path()
    10609   0.238331   0.071125  2()
    10609   0.167206   0.055477  1()
      103   0.494629   0.029297  <SNR>4_rtp_add_a()
      104   0.434962   0.028427  <SNR>4_rtp_rm_a()
       13              0.028053  TagHighlight#LoadDataFile#LoadFile()
        4   0.034772   0.024908  DoxygenReadTemplates()
        3   0.026625   0.022328  <SNR>191__build_module()
       19   0.019326   0.018752  <SNR>126_createtimehandler()
      577              0.015858  <SNR>191__unify_path()
        3   0.032555   0.015258  <SNR>191__scripts()
       57              0.013005  <SNR>131_IsInDict()
        1   0.042380   0.011695  <SNR>131_ParseFileAssociationList()
      103              0.007290  <SNR>4_parse_name()
        1   0.009286   0.005968  <SNR>131_CheckLinks()
        6              0.005852  <SNR>191__redir()
      186              0.005455  <SNR>131_Trim()
        3   0.005856   0.005276  <SNR>41__build_module()
  • neobundle
    FUNCTIONS SORTED ON TOTAL TIME
    count  total (s)   self (s)  function
        1   0.066579   0.000623  <SNR>141_browse_check()
        3   0.058909   0.002727  vital#of()
        1   0.042700   0.000025  vital#_c7f20e#new()
        2   0.042675   0.000119  <SNR>193_import()
        1   0.040882   0.000043  <SNR>113_SetWatchExtension()
        1   0.040839   0.000061  <SNR>113_CreateDict()
        1   0.040778   0.011425  <SNR>113_ParseFileAssociationList()
        4   0.034289   0.024681  DoxygenReadTemplates()
        3   0.032798   0.015414  <SNR>193__scripts()
        3   0.030485   0.000426  <SNR>193__import()
       13   0.028208             TagHighlight#LoadDataFile#LoadFile()
        3   0.028024   0.023446  <SNR>193__build_module()
        2   0.027718   0.002674  zlib#sys#ostype()
      103   0.026822   0.002443  neobundle#config#bundle()
        1   0.026240   0.000118  DoxygenRereadTemplates()
        1   0.021219   0.001987  <SNR>71_LoadKinds()
        1   0.020836   0.000109  <SNR>193_load()
       19   0.020401   0.001387  <SNR>118_adddate()
        1   0.019232   0.000056  TagHighlight#LoadDataFile#LoadDataFile()
       19   0.019014   0.018467  <SNR>118_createtimehandler()

    FUNCTIONS SORTED ON SELF TIME
    count  total (s)   self (s)  function
       13              0.028208  TagHighlight#LoadDataFile#LoadFile()
        4   0.034289   0.024681  DoxygenReadTemplates()
        3   0.028024   0.023446  <SNR>193__build_module()
       19   0.019014   0.018467  <SNR>118_createtimehandler()
      583              0.016030  <SNR>193__unify_path()
        3   0.032798   0.015414  <SNR>193__scripts()
       57              0.012847  <SNR>113_IsInDict()
        1   0.040778   0.011425  <SNR>113_ParseFileAssociationList()
      103              0.009645  <SNR>4_parse_name()
      103              0.008889  <SNR>4_rtp_add()
        6              0.006060  <SNR>193__redir()
        1   0.008992   0.005763  <SNR>113_CheckLinks()
        3   0.006385   0.005713  <SNR>43__build_module()
      186              0.005328  <SNR>113_Trim()
        1              0.004271  <SNR>124_FencCreateMenu()
      103   0.015490   0.003813  neobundle#config#init_bundle()
      133              0.003378  <SNR>43__unify_path()
        3   0.006961   0.003348  <SNR>43__scripts()
       40              0.002860  zlib#rc#script_load_guard()
        3   0.058909   0.002727  vital#of()
@gmarik

Yeah, i'm aware about this issue.
Vundle has some boot up time affecting algorithm as for rtp modification.
Neobundle guys just never bothered contributing stuff back ;)

I'll work on it, as you're probably the 5th person complaining about it

@gmarik

Thanks for detailed profiling details BTW

@zhaocai

You are welcome. I used vundle to manage plugins since "day one". No doubt It is one of the most popular vim plugins manager. But it might really need improvements.

@Shougo

Hi, I'm the author of neobundle.

Neobundle guys just never bothered contributing stuff back ;)

Yes, I used old(and modified version) vundle.
But current vundle has more difference from it.
So, I forked and renamed it.
The modifications are too much, I don't send patch. Sorry.

@gmarik

hey @zhaocai
I pushed some speed related improvements to (faster branch)
Could you check it out and see how that works for you?
it should be about 3 times faster.
(it's not heavily tested so expect unexpected )

cd ~/.vim/bundle/vundle 
git pull
git checkout -b faster origin/faster
vim

Also if you could share profiling results - would be just great!
Thanks!

@zhaocai

Test Result for faster branch. it does show substantial improvement :)

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
  101   0.195244   0.003830  vundle#config#bundle()
  101   0.089699             <SNR>4_rtp_add_a()
  102   0.087859             <SNR>4_rtp_rm_a()
    1   0.065165   0.000930  <SNR>102_browse_check()
    2   0.053892   0.002675  vital#of()
    1   0.043101   0.000043  <SNR>130_SetWatchExtension()
    1   0.043058   0.000066  <SNR>130_CreateDict()
    1   0.042992   0.011883  <SNR>130_ParseFileAssociationList()
    1   0.041691   0.000034  vital#_c7f20e#new()
    2   0.041657   0.000125  <SNR>188_import()
    4   0.034524   0.024797  DoxygenReadTemplates()
    3   0.032305   0.015280  <SNR>188__scripts()
    3   0.029073   0.000448  <SNR>188__import()
   13   0.028267             TagHighlight#LoadDataFile#LoadFile()
    2   0.026682   0.002697  zlib#sys#ostype()
    3   0.026478   0.022147  <SNR>188__build_module()
    1   0.026249   0.000117  DoxygenRereadTemplates()
    1   0.021273   0.002068  <SNR>168_LoadKinds()
   19   0.020827   0.001414  <SNR>125_adddate()
    1   0.019951   0.000105  <SNR>188_load()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
  101              0.089699  <SNR>4_rtp_add_a()
  102              0.087859  <SNR>4_rtp_rm_a()
   13              0.028267  TagHighlight#LoadDataFile#LoadFile()
    4   0.034524   0.024797  DoxygenReadTemplates()
    3   0.026478   0.022147  <SNR>188__build_module()
   19   0.019413   0.018852  <SNR>125_createtimehandler()
  568              0.015625  <SNR>188__unify_path()
    3   0.032305   0.015280  <SNR>188__scripts()
   57              0.013245  <SNR>130_IsInDict()
    1   0.042992   0.011883  <SNR>130_ParseFileAssociationList()
  101              0.006964  <SNR>4_parse_name()
    1   0.009254   0.005950  <SNR>130_CheckLinks()
    6              0.005852  <SNR>188__redir()
  186              0.005642  <SNR>130_Trim()
    3   0.005523   0.004987  <SNR>41__build_module()
    1              0.004128  <SNR>119_FencCreateMenu()
  101   0.195244   0.003830  vundle#config#bundle()
  101   0.013897   0.003342  vundle#config#init_bundle()
  127              0.003121  <SNR>41__unify_path()
    3   0.006438   0.003100  <SNR>41__scripts()
@gmarik gmarik was assigned Feb 10, 2012
@robi-wan

Any progress on this issue?

@gmarik

I'll merge this today/tomorrow

@gmarik

ok, it's in master (0.9.1) now.

Feel free to reopen if case of any issues.

@gmarik gmarik closed this Mar 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment