Closed thom-nic closed 6 years ago
Not just MacOS, editorconfig is very slow and heavy so > 4s is also possible.
Can you print the log of starting up Vim?
Addition of ~200ms (total ~400ms) to starting time on my laptop x220, definitely a lot slower when using pi (pi used to be my main desktop).
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.029 000.029: --- NVIM STARTING ---
000.397 000.368: locale set
001.035 000.638: inits 1
001.050 000.015: window checked
001.360 000.310: parsing arguments
001.366 000.005: expanding arguments
001.447 000.081: inits 2
001.903 000.457: init highlight
002.055 000.033 000.033: sourcing $VIM/sysinit.vim
004.695 002.502 002.502: sourcing /home/ivan/.config/nvim/autoload/plug.vim
010.101 000.018 000.018: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/ftdetect/typescript.vim
010.351 000.021 000.021: sourcing /home/ivan/.config/nvim/plugged/vim-pug/ftdetect/pug.vim
010.733 000.012 000.012: sourcing /home/ivan/.config/nvim/plugged/rust.vim/ftdetect/rust.vim
011.167 000.058 000.058: sourcing /home/ivan/.config/nvim/plugged/vim-fish/ftdetect/fish.vim
011.410 000.027 000.027: sourcing /home/ivan/.config/nvim/plugged/vim-toml/ftdetect/toml.vim
011.651 000.017 000.017: sourcing /home/ivan/.config/nvim/plugged/vim-ledger/ftdetect/ledger.vim
011.892 000.017 000.017: sourcing /home/ivan/.config/nvim/plugged/vim-vue/ftdetect/vue.vim
025.302 000.055 000.055: sourcing /usr/share/vim/vimfiles/ftdetect/dockerfile.vim
025.403 000.080 000.080: sourcing /usr/share/vim/vimfiles/ftdetect/nginx.vim
025.512 000.090 000.090: sourcing /usr/share/vim/vimfiles/ftdetect/task.vim
025.569 000.041 000.041: sourcing /usr/share/vim/vimfiles/ftdetect/tup.vim
025.633 012.535 012.269: sourcing /usr/share/nvim/runtime/filetype.vim
025.724 000.033 000.033: sourcing /usr/share/nvim/runtime/ftplugin.vim
025.818 000.033 000.033: sourcing /usr/share/nvim/runtime/indent.vim
026.212 000.210 000.210: sourcing /usr/share/nvim/runtime/syntax/syncolor.vim
026.319 000.383 000.173: sourcing /usr/share/nvim/runtime/syntax/synload.vim
026.347 000.481 000.098: sourcing /usr/share/nvim/runtime/syntax/syntax.vim
026.885 000.168 000.168: sourcing /usr/share/nvim/runtime/syntax/syncolor.vim
027.130 000.037 000.037: sourcing /usr/share/nvim/runtime/autoload/netrw_gitignore.vim
044.829 042.737 026.780: sourcing /home/ivan/.config/nvim/init.vim
044.845 000.171: sourcing vimrc file(s)
046.367 000.703 000.703: sourcing /home/ivan/.config/nvim/plugged/editorconfig-vim/plugin/editorconfig.vim
047.143 000.480 000.480: sourcing /home/ivan/.config/nvim/plugged/colorizer/autoload/colorizer.vim
047.640 001.165 000.686: sourcing /home/ivan/.config/nvim/plugged/colorizer/plugin/colorizer.vim
048.789 001.044 001.044: sourcing /home/ivan/.config/nvim/plugged/vim-gnupg/plugin/gnupg.vim
049.240 000.021 000.021: sourcing /usr/share/nvim/runtime/plugin/gui_shim.vim
049.553 000.287 000.287: sourcing /usr/share/nvim/runtime/plugin/gzip.vim
049.620 000.033 000.033: sourcing /usr/share/nvim/runtime/plugin/health.vim
049.726 000.069 000.069: sourcing /usr/share/nvim/runtime/plugin/man.vim
050.244 000.499 000.499: sourcing /usr/share/nvim/runtime/plugin/matchit.vim
050.452 000.185 000.185: sourcing /usr/share/nvim/runtime/plugin/matchparen.vim
050.937 000.463 000.463: sourcing /usr/share/nvim/runtime/plugin/netrwPlugin.vim
051.464 000.208 000.208: sourcing /usr/share/nvim/runtime/autoload/remote/host.vim
051.940 000.191 000.191: sourcing /usr/share/nvim/runtime/autoload/remote/define.vim
055.338 004.178 003.779: sourcing /home/ivan/.local/share/nvim/rplugin.vim
055.350 004.375 000.197: sourcing /usr/share/nvim/runtime/plugin/rplugin.vim
055.394 000.019 000.019: sourcing /usr/share/nvim/runtime/plugin/rrhelper.vim
055.527 000.110 000.110: sourcing /usr/share/nvim/runtime/plugin/shada.vim
055.598 000.034 000.034: sourcing /usr/share/nvim/runtime/plugin/spellfile.vim
055.793 000.169 000.169: sourcing /usr/share/nvim/runtime/plugin/tarPlugin.vim
055.920 000.099 000.099: sourcing /usr/share/nvim/runtime/plugin/tohtml.vim
055.977 000.027 000.027: sourcing /usr/share/nvim/runtime/plugin/tutor.vim
056.207 000.205 000.205: sourcing /usr/share/nvim/runtime/plugin/zipPlugin.vim
056.228 001.875: loading plugins
056.342 000.114: loading packages
056.390 000.048: loading after plugins
056.405 000.015: inits 3
062.676 006.271: reading ShaDa
063.705 001.029: clearing screen
078.149 004.383 004.383: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/syntax/typescript.vim
078.804 000.133 000.133: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/compiler/typescript.vim
078.965 000.453 000.319: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/ftplugin/typescript.vim
080.585 000.936 000.936: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/indent/typescript.vim
081.029 000.090 000.090: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/compiler/typescript.vim
081.140 000.286 000.196: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/ftplugin/typescript.vim
081.811 000.057 000.057: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/indent/typescript.vim
083.370 001.313 001.313: sourcing /home/ivan/.config/nvim/plugged/typescript-vim/syntax/typescript.vim
085.418 000.086 000.086: sourcing /usr/share/nvim/runtime/autoload/provider/pythonx.vim
102.980 017.745 017.659: sourcing /usr/share/nvim/runtime/autoload/provider/python.vim
165.333 000.137 000.137: sourcing /usr/share/nvim/runtime/autoload/provider.vim
176.658 000.177 000.177: sourcing /home/ivan/.config/nvim/plugged/editorconfig-vim/autoload/editorconfig.vim
209.294 032.163 032.163: sourcing /usr/share/nvim/runtime/autoload/provider/python3.vim
342.973 221.620: opening buffers
385.392 042.420: BufEnter autocommands
385.405 000.012: editing files in windows
385.527 000.122: VimEnter autocommands
395.198 009.573 009.573: sourcing /usr/share/nvim/runtime/autoload/provider/clipboard.vim
395.221 000.121: before starting main loop
402.176 006.955: first screen update
402.185 000.009: --- NVIM STARTED ---
If it's PI, perhaps it's the hard drive that is slow? EditorConfig needs to seek file systems all the way up to root.
@xuhdev pi uses sd card, not hard drive. I think the slowness might be caused by the slow startup time of python or am I wrong?
@pickfire It looks like it's real that Python on PI is slow. In this case, you can switch g:EditorConfig_core_mode
to external_command
and install the C core executable (apt-get install editorconfig
).
@xuhdev Wow, I didn't know about that (lazy to read the help pages after it is so slow). It feels like more than 10x faster here (not pi) in startup time. Wonder why isn't that the default?
@pickfire Because python_builtin
is the most reliable one :) But this does not seem resolving the OP's problem.
Here's my startup log, with all other plugins disabled (except dosini, apparently..)
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.008 000.008: --- VIM STARTING ---
000.116 000.108: Allocated generic buffers
000.510 000.394: locale set
000.515 000.005: clipboard setup
000.526 000.011: window checked
001.193 000.667: inits 1
001.381 000.188: parsing arguments
001.387 000.006: expanding arguments
008.794 007.407: shell init
009.158 000.364: Termcap init
009.193 000.035: inits 2
009.369 000.176: init highlight
009.975 000.062 000.062: sourcing /usr/local/share/vim/vim80/ftoff.vim
010.340 000.234 000.234: sourcing /Users/thom/.vim/bundle/Vundle.vim/autoload/vundle.vim
010.773 000.308 000.308: sourcing /Users/thom/.vim/bundle/Vundle.vim/autoload/vundle/config.vim
019.673 007.558 007.558: sourcing /usr/local/share/vim/vim80/filetype.vim
019.863 000.054 000.054: sourcing /usr/local/share/vim/vim80/ftplugin.vim
020.035 000.052 000.052: sourcing /usr/local/share/vim/vim80/indent.vim
021.450 000.987 000.987: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
021.611 001.270 000.283: sourcing /usr/local/share/vim/vim80/syntax/synload.vim
021.649 001.441 000.171: sourcing /usr/local/share/vim/vim80/syntax/syntax.vim
022.182 000.199 000.199: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
022.625 000.189 000.189: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
023.004 000.190 000.190: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
023.281 001.525 000.947: sourcing /usr/local/share/vim/vim80/colors/desert.vim
023.778 000.197 000.197: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
024.275 000.192 000.192: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
024.652 000.192 000.192: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
025.166 001.810 001.229: sourcing /Users/thom/.vim/bundle/molokai/colors/molokai.vim
025.513 015.885 002.841: sourcing $HOME/.vimrc
025.521 000.267: sourcing vimrc file(s)
027.583 000.738 000.738: sourcing /Users/thom/.vim/bundle/editorconfig-vim/plugin/editorconfig.vim
028.315 000.083 000.083: sourcing /usr/local/share/vim/vim80/plugin/getscriptPlugin.vim
028.706 000.346 000.346: sourcing /usr/local/share/vim/vim80/plugin/gzip.vim
029.033 000.287 000.287: sourcing /usr/local/share/vim/vim80/plugin/logiPat.vim
029.119 000.043 000.043: sourcing /usr/local/share/vim/vim80/plugin/manpager.vim
029.362 000.205 000.205: sourcing /usr/local/share/vim/vim80/plugin/matchparen.vim
030.344 000.940 000.940: sourcing /usr/local/share/vim/vim80/plugin/netrwPlugin.vim
030.444 000.034 000.034: sourcing /usr/local/share/vim/vim80/plugin/rrhelper.vim
030.547 000.049 000.049: sourcing /usr/local/share/vim/vim80/plugin/spellfile.vim
030.824 000.226 000.226: sourcing /usr/local/share/vim/vim80/plugin/tarPlugin.vim
030.992 000.115 000.115: sourcing /usr/local/share/vim/vim80/plugin/tohtml.vim
031.248 000.205 000.205: sourcing /usr/local/share/vim/vim80/plugin/vimballPlugin.vim
031.540 000.231 000.231: sourcing /usr/local/share/vim/vim80/plugin/zipPlugin.vim
031.576 002.553: loading plugins
031.665 000.089: loading packages
031.760 000.095: loading after plugins
031.770 000.010: inits 3
041.313 009.543: reading viminfo
041.373 000.060: setting raw mode
041.397 000.024: start termcap
041.424 000.027: clearing screen
044.259 000.074 000.074: sourcing /usr/local/share/vim/vim80/ftplugin/dosini.vim
045.235 000.102 000.102: sourcing /usr/local/share/vim/vim80/syntax/dosini.vim
2988.817 000.136 000.136: sourcing /Users/thom/.vim/bundle/editorconfig-vim/autoload/editorconfig.vim
2989.365 000.063 000.063: sourcing /usr/local/share/vim/vim80/ftplugin/dosini.vim
2990.375 000.077 000.077: sourcing /usr/local/share/vim/vim80/syntax/dosini.vim
2990.578 2948.702: opening buffers
2990.639 000.061: BufEnter autocommands
2990.647 000.008: editing files in windows
2990.903 000.256: VimEnter autocommands
2990.905 000.002: before starting main loop
2992.242 001.337: first screen update
2992.244 000.002: --- VIM STARTED ---
So, I was not far off, autoload/editorconfig.vim
is adding ~2.9 seconds to startup. Note I have a .editorconfig with root = true
in my cwd of the file I am opening; one would think that would eliminate the directory traversal. Maybe root
does not mean what I think it means...
Maybe this is obvious to others, but I guess I should clarify... Invoking vim
without any file argument is fast, because no autoload script is running. vim somefile.txt
is slow... As is :e somefile.txt
after opening vim, when the vim-editorconfig plugin is enabled. So clearly it is the autoload component, not strictly "startup."
From your log, it looks like editorconfig is pretty quick to load, but opening buffers take a much longer time. root = true
should stop directory traversal. Have you tried python_builtin
? Is your harddrive super slow?
I'm on a core i5 mbp with SSD, so no, not a slow HDD. Also ran it several times so the file would be cached.
This is somewhat self-referential as I'm testing by doing vim .editorconfig
... It's a 20 line file.
I'll run again with python_builtin
and report back.
Does editorconfig do anything crazy like invoke zsh -l
? If I didn't know better I might suspect all my zsh interactive init was being invoked.
@thom-nic I don't so. Does the editorconfig executable work well on command line? You can try editorconfig $(pwd)/my.ext
.
@xuhdev $PWD/my.ext
time editorconfig $(pwd)/.editorconfig
charset=utf-8
indent_style=space
indent_size=2
end_of_line=lf
insert_final_newline=true
trim_trailing_whitespace=true
tab_width=2
editorconfig $(pwd)/.editorconfig 0.00s user 0.00s system 67% cpu 0.005 total
So, editorconfig $(pwd)/somefile
by itself is not slow. I also tried with python_external
: I added the following @ top of my .vimrc, before plugin load:
let g:EditorConfig_core_mode = 'python_external'
let g:python_host_prog='/usr/local/bin/python2'
let g:python3_host_prog='/usr/local/bin/python3'
Startup/autoload time appears unaffected:
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.007 000.007: --- VIM STARTING ---
000.113 000.106: Allocated generic buffers
000.484 000.371: locale set
000.489 000.005: clipboard setup
000.499 000.010: window checked
001.056 000.557: inits 1
001.205 000.149: parsing arguments
001.210 000.005: expanding arguments
007.820 006.610: shell init
008.130 000.310: Termcap init
008.148 000.018: inits 2
008.322 000.174: init highlight
008.997 000.146 000.146: sourcing /usr/local/share/vim/vim80/ftoff.vim
009.471 000.229 000.229: sourcing /Users/thom/.vim/bundle/Vundle.vim/autoload/vundle.vim
009.794 000.199 000.199: sourcing /Users/thom/.vim/bundle/Vundle.vim/autoload/vundle/config.vim
017.681 007.118 007.118: sourcing /usr/local/share/vim/vim80/filetype.vim
017.861 000.060 000.060: sourcing /usr/local/share/vim/vim80/ftplugin.vim
018.007 000.046 000.046: sourcing /usr/local/share/vim/vim80/indent.vim
019.126 000.821 000.821: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
019.249 001.046 000.225: sourcing /usr/local/share/vim/vim80/syntax/synload.vim
019.280 001.179 000.133: sourcing /usr/local/share/vim/vim80/syntax/syntax.vim
019.714 000.180 000.180: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
020.105 000.172 000.172: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
020.443 000.174 000.174: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
020.689 001.327 000.801: sourcing /usr/local/share/vim/vim80/colors/desert.vim
021.122 000.173 000.173: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
021.590 000.209 000.209: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
021.999 000.200 000.200: sourcing /usr/local/share/vim/vim80/syntax/syncolor.vim
022.518 001.767 001.185: sourcing /Users/thom/.vim/bundle/molokai/colors/molokai.vim
022.908 014.334 002.263: sourcing $HOME/.vimrc
022.917 000.261: sourcing vimrc file(s)
024.856 000.765 000.765: sourcing /Users/thom/.vim/bundle/editorconfig-vim/plugin/editorconfig.vim
025.699 000.088 000.088: sourcing /usr/local/share/vim/vim80/plugin/getscriptPlugin.vim
026.105 000.360 000.360: sourcing /usr/local/share/vim/vim80/plugin/gzip.vim
026.458 000.296 000.296: sourcing /usr/local/share/vim/vim80/plugin/logiPat.vim
026.554 000.049 000.049: sourcing /usr/local/share/vim/vim80/plugin/manpager.vim
026.812 000.217 000.217: sourcing /usr/local/share/vim/vim80/plugin/matchparen.vim
027.614 000.759 000.759: sourcing /usr/local/share/vim/vim80/plugin/netrwPlugin.vim
027.719 000.030 000.030: sourcing /usr/local/share/vim/vim80/plugin/rrhelper.vim
027.821 000.049 000.049: sourcing /usr/local/share/vim/vim80/plugin/spellfile.vim
028.169 000.296 000.296: sourcing /usr/local/share/vim/vim80/plugin/tarPlugin.vim
028.386 000.130 000.130: sourcing /usr/local/share/vim/vim80/plugin/tohtml.vim
028.655 000.215 000.215: sourcing /usr/local/share/vim/vim80/plugin/vimballPlugin.vim
028.948 000.228 000.228: sourcing /usr/local/share/vim/vim80/plugin/zipPlugin.vim
028.977 002.578: loading plugins
029.060 000.083: loading packages
029.122 000.062: loading after plugins
029.132 000.010: inits 3
038.386 009.254: reading viminfo
038.481 000.095: setting raw mode
038.489 000.008: start termcap
038.512 000.023: clearing screen
040.817 000.073 000.073: sourcing /usr/local/share/vim/vim80/ftplugin/dosini.vim
041.755 000.109 000.109: sourcing /usr/local/share/vim/vim80/syntax/dosini.vim
2850.515 000.171 000.171: sourcing /Users/thom/.vim/bundle/editorconfig-vim/autoload/editorconfig.vim
2851.156 000.083 000.083: sourcing /usr/local/share/vim/vim80/ftplugin/dosini.vim
2852.394 000.121 000.121: sourcing /usr/local/share/vim/vim80/syntax/dosini.vim
2852.620 2813.551: opening buffers
2852.693 000.073: BufEnter autocommands
2852.699 000.006: editing files in windows
2853.066 000.367: VimEnter autocommands
2853.070 000.004: before starting main loop
2854.942 001.872: first screen update
2854.944 000.002: --- VIM STARTED ---
Maybe it's something in Vim? Can you paste the output of vim --version
?
Installed via homebrew:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 24 2018 05:16:21)
macOS version
Included patches: 1-1750
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_sgr -tag_any_white
+arabic +file_in_path -mouse_sysmouse -tcl
+autocmd +find_in_path +mouse_urxvt +termguicolors
-autoservername +float +mouse_xterm +terminal
-balloon_eval +folding +multi_byte +terminfo
+balloon_eval_term -footer +multi_lang +termresponse
-browse +fork() -mzscheme +textobjects
++builtin_terms -gettext +netbeans_intg +timers
+byte_offset -hangul_input +num64 +title
+channel +iconv +packages -toolbar
+cindent +insert_expand +path_extra +user_commands
-clientserver +job +perl +vertsplit
+clipboard +jumplist +persistent_undo +virtualedit
+cmdline_compl +keymap +postscript +visual
+cmdline_hist +lambda +printer +visualextra
+cmdline_info +langmap +profile +viminfo
+comments +libcall -python +vreplace
+conceal +linebreak +python3 +wildignore
+cryptv +lispindent +quickfix +wildmenu
+cscope +listcmds +reltime +windows
+cursorbind +localmap +rightleft +writebackup
+cursorshape -lua +ruby -X11
+dialog_con +menu +scrollbind -xfontset
+diff +mksession +signs -xim
+digraphs +modify_fname +smartindent -xpm
-dnd +mouse +startuptime -xsmp
-ebcdic -mouseshape +statusline -xterm_clipboard
+emacs_tags +mouse_dec -sun_workshop -xterm_save
+eval -mouse_gpm +syntax
+ex_extra -mouse_jsbterm +tag_binary
+extra_search +mouse_netterm +tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -D_DARWIN_C_SOURCE -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lncurses -liconv -framework AppKit -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.26.2/lib/perl5/5.26.2/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation -lruby.2.5.1 -lobjc
It looks like you did not try python_internal
. Can you test that? I'm suspecting Vim's external process calling may be the issue.
If I add let g:EditorConfig_core_mode = 'python_internal'
to my .vimrc, I get the following error in my statusline when I open a file:
Unknown EditorConfig Core: python_internal
Double-confirmed that my ~/.vim/bundle/editorconfig-vim
is at 0abb063.
Ok, the problem is vim's external command - more specifically, startup time for my login shell in general. Running :!ls
was taking just as long. Solved by adding set shell=/bin/bash
(and then hunting down what in my ~/.zshenv
is taking so long for non-interactive sessions.)
Not sure why python_internal
was not working, however solving the startup time for noninteractive zsh
sessions on my machine fixed my issue here. Thanks for helping me track it down!
On master 0abb063, vim:
I saw #50, tried the following after
brew install editorconfig
as well as:
None of which seemed to make any difference. I'm using Vundle (if that matters) and when I comment out only
editorconfig-vim
I get sub-second startup. With editorconfig-vim, startup is ~4s on a 2.3GHz Core i7 2013 MBP/ 16 GB RAM.