weixin_39733812
weixin_39733812
2020-12-31 02:14

slow startup on windows

Hi I'm sorry that my English isn't very good. I found https://github.com/wakatime/vim-wakatime/issues/28 . but this issue is closed ...

I using this plugin to vim on windows10. but very very slowly vim to startup.

i testing this vimrc


call plug#begin($VIM.'\vimfiles\plugins')
Plug 'wakatime/vim-wakatime'
call plug#end()

and this startuptime log




times in msec
 clock   self+sourced   self:  sourced script
 clock   elapsed:              other lines

000.000  000.000: --- VIM STARTING ---
000.000  000.000: Allocated generic buffers
001.000  001.000: locale set
001.000  000.000: GUI prepared
003.000  002.000: clipboard setup
003.000  000.000: window checked
003.000  000.000: inits 1
010.000  007.000: parsing arguments
010.000  000.000: expanding arguments
012.000  002.000: shell init
012.000  000.000: inits 2
013.000  001.000: init highlight
017.000  002.000  002.000: sourcing C:\app\vim\vimfiles\autoload\plug.vim
028.000  000.000  000.000: sourcing C:\app\vim\vim80\lang\menu_ja_jp.utf-8.vim
030.000  000.000  000.000: sourcing C:\app\vim\vim80\autoload\paste.vim
036.000  009.000  009.000: sourcing C:\app\vim\vim80/menu.vim
036.000  016.000  007.000: sourcing C:\app\vim\vim80\filetype.vim
038.000  000.000  000.000: sourcing C:\app\vim\vim80\ftplugin.vim
040.000  000.000  000.000: sourcing C:\app\vim\vim80\indent.vim
044.000  000.000  000.000: sourcing C:\app\vim\vim80\syntax\syncolor.vim
044.000  002.000  002.000: sourcing C:\app\vim\vim80\syntax\synload.vim
044.000  004.000  002.000: sourcing C:\app\vim\vim80\syntax\syntax.vim
044.000  031.000  009.000: sourcing test_vimrc
044.000  000.000: sourcing vimrc file(s)
6935.000  001.000  001.000: sourcing C:\app\vim\vimfiles\plugins\vim-wakatime\plugin\wakatime.vim
6941.000  000.000  000.000: sourcing C:\app\vim\vim80\plugin\getscriptPlugin.vim
6942.000  000.000  000.000: sourcing C:\app\vim\vim80\plugin\gzip.vim
6943.000  001.000  001.000: sourcing C:\app\vim\vim80\plugin\logiPat.vim
6944.000  001.000  001.000: sourcing C:\app\vim\vim80\plugin\manpager.vim
6945.000  001.000  001.000: sourcing C:\app\vim\vim80\plugin\matchparen.vim
6946.000  000.000  000.000: sourcing C:\app\vim\vim80\plugin\netrwPlugin.vim
6947.000  000.000  000.000: sourcing C:\app\vim\vim80\plugin\rrhelper.vim
6948.000  000.000  000.000: sourcing C:\app\vim\vim80\plugin\spellfile.vim
6949.000  001.000  001.000: sourcing C:\app\vim\vim80\plugin\tarPlugin.vim
6950.000  001.000  001.000: sourcing C:\app\vim\vim80\plugin\tohtml.vim
6950.000  000.000  000.000: sourcing C:\app\vim\vim80\plugin\vimballPlugin.vim
6951.000  000.000  000.000: sourcing C:\app\vim\vim80\plugin\zipPlugin.vim
6951.000  6901.000: loading plugins
6952.000  001.000: loading packages
6952.000  000.000: loading after plugins
6952.000  000.000: inits 3
6954.000  001.000  001.000: sourcing $VIMRUNTIME\menu.vim
6959.000  004.000  004.000: sourcing $HOME\_gvimrc
8574.000  005.000  005.000: sourcing C:\app\vim\vim80\syntax\syncolor.vim
8574.000  1612.000: starting GUI
8575.000  001.000: reading viminfo
8621.000  046.000: GUI delay
8621.000  000.000: setting raw mode
8621.000  000.000: start termcap
8621.000  000.000: clearing screen
8622.000  001.000: opening buffers
8623.000  001.000: BufEnter autocommands
8623.000  000.000: editing files in windows
8625.000  002.000: VimEnter autocommands
8625.000  000.000: before starting main loop
8635.000  010.000: first screen update
8635.000  000.000: --- VIM STARTED ---

and and vim version


VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov  7 2017 10:57:15)
MS-Windows 64-bit console version
Included patches: 1-1274
Compiled by rmaejima
Huge version without GUI.  Features included (+) or not (-):
+acl                +extra_search       +mouse              +tag_old_static
+arabic             +farsi              -mouseshape         -tag_any_white
+autocmd            +file_in_path       +multi_byte_ime/dyn -tcl
-balloon_eval       +find_in_path       +multi_lang         +termguicolors
-browse             +float              -mzscheme           +terminal
++builtin_terms     +folding            -netbeans_intg      -tgetent
+byte_offset        -footer             +num64              -termresponse
+channel            +gettext/dyn        +packages           +textobjects
+cindent            +guess_encode       +path_extra         +timers
+clientserver       -hangul_input       +perl/dyn           +title
+clipboard          +iconv/dyn          +persistent_undo    -toolbar
+cmdline_compl      +insert_expand      -postscript         +user_commands
+cmdline_hist       +job                +printer            +vertsplit
+cmdline_info       +jumplist           +profile            +virtualedit
+comments           +kaoriya            +python/dyn         +visual
+conceal            +keymap             +python3/dyn        +visualextra
+cryptv             +lambda             +quickfix           +viminfo
+cscope             +langmap            +reltime            +vreplace
+cursorbind         +libcall            +rightleft          +wildignore
+cursorshape        +linebreak          -ruby               +wildmenu
+dialog_con         +lispindent         +scrollbind         +windows
+diff               +listcmds           +signs              +writebackup
+digraphs           +localmap           +smartindent        -xfontset
-dnd                +lua/dyn            +startuptime        -xim
-ebcdic             +menu               +statusline         -xpm_w32
+emacs_tags         -migemo             -sun_workshop       -xterm_save
+eval               +mksession          +syntax             
+ex_extra           +modify_fname       +tag_binary         
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
       defaults file: "$VIMRUNTIME\defaults.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_TERMINAL  -DFEAT_JOB_CHANNEL      -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG  /MD -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_MBYTE -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_LUA -DDYNAMIC_LUA  -DDYNAMIC_LUA_DLL=\"lua5.3.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python35.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl524.dll\" -DFEAT_HUGE /Fd.\ObjCULYHAMD64/ /Zi
Linking: link  /nologo /subsystem:console /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib uuid.lib /machine:AMD64  /nodefaultlib msvcrt.lib  user32.lib  /nodefaultlib:lua5.3.lib   /nodefaultlib:python27.lib /nodefaultlib:python35.lib    WSock32.lib  /PDB:vim.pdb -debug


D:\tmp\20171121>python -V
Python 3.5.2 :: Anaconda custom (64-bit)

D:\tmp\20171121>

Do you have any solutions?

Best Regards,

该提问来源于开源项目:wakatime/vim-wakatime

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

14条回答

  • weixin_39993322 weixin_39993322 4月前

    I have exactly the same problem, also windows 10, using pathogen. This is a big deal -- vim normally starts up lightening fast (it's one the reasons it's my quick go-to editor) -- adding 3-6 seconds to startup time feels like an eternity. I'd like to have wakatime running for vim sessions -- but I just can't take this hit, considering how often I open vim in a day )':

    点赞 评论 复制链接分享
  • weixin_39993322 weixin_39993322 4月前

    further testing shows this may be a problem with pathogen: if I move the vim-wakatime directory, to eg vimfiles/bundle/disabled/vim-wakatime and then manually load in my .vimrc:

    
    source ~/vimfiles/bundle/disabled/vim-wakatime/plugin/wakatime.vim
    

    Then vim starts up quickly again. I'm going to create an issue over at https://github.com/tpope/vim-pathogen/issues and reference here.

    点赞 评论 复制链接分享
  • weixin_39830175 weixin_39830175 4月前

    Can you try updating vim-wakatime and see if the slow startup is fixed?

    f9e5760e72ae58e8c33b527e09554a7a3de03b08 moves the plugin/packages folder into autoload to exempt them from runtimepath scans.

    点赞 评论 复制链接分享
  • weixin_39993322 weixin_39993322 4月前

    Wurks Grate!

    点赞 评论 复制链接分享
  • weixin_39778003 weixin_39778003 4月前

    It is faster than before, but still takes me about 15 seconds to startup GVim. PS: I'm using Vundle as plugin manager.

    点赞 评论 复制链接分享
  • weixin_39993322 weixin_39993322 4月前

    that's strange -- using Pathogen, startup is practically instant

    点赞 评论 复制链接分享
  • weixin_39830175 weixin_39830175 4月前

    can you make sure the old folder vim-wakatime/plugin/packages/wakatime is deleted? Vundle uses git to download updates and could have left *.pyc files that might have prevented that folder from being deleted.

    点赞 评论 复制链接分享
  • weixin_39778003 weixin_39778003 4月前

    Thanks, I deleted the old directory and clone this repo manually again, and it is very fast now (about 2 second) , this is a very satisfactory speed. Thanks for your great job 👍

    点赞 评论 复制链接分享
  • weixin_39733812 weixin_39733812 4月前

    Holy! I remove old directory and reinstall vim-wakatime. before startup time is 6~10sec. but after startup time is 0.5sec return to an original state !! thanks great work!

    点赞 评论 复制链接分享
  • weixin_39984578 weixin_39984578 4月前

    I had an issue with an increase of ~2 sec startuptime after adding the wakatime-plugin. Using macOS VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 29 2020 00:47:39) Setting $WAKATIME_HOME to something explicit (export WAKATIME_HOME="$HOME" for instance) seems to have reduced the startuptime to 1ms for the wakatime-plugin.

    Expanding unset env vars in vim seems to be slow, at least in my case. For instance expand("$AN_ENV_VAR_NOT_SET") takes about 2 sec, expand("$HOME") on the other hand is fast. Hopefully this might help others too.

    点赞 评论 复制链接分享
  • weixin_39830175 weixin_39830175 4月前

    We're working on porting the plugin core from Python to Go, which will greatly improve the startup time by removing the code searching for the Python binary.

    点赞 评论 复制链接分享
  • weixin_39585035 weixin_39585035 4月前

    We're working on porting the plugin core from Python to Go, which will greatly improve the startup time by removing the code searching for the Python binary.

    How's the progress on this? Wakatime is the slowest plugin I have right now...taking over 500ms to load

    点赞 评论 复制链接分享
  • weixin_39830175 weixin_39830175 4月前

    We're using it internally, but still need:

    • more language detection support
    • proxy support
    • hidden file POSIX regex

    Probably a few more features that I'm forgetting. is managing the timeline for that project, he might be able to provide more details.

    点赞 评论 复制链接分享
  • weixin_39955351 weixin_39955351 4月前

    We're already testing it internally but mainly dealing with small fixes time by time. We expect it to be much faster than the python's version. Soon we probably release a beta version to the community.

    点赞 评论 复制链接分享

相关推荐