mhinz / vim-startify

:link: The fancy start screen for Vim.
MIT License
5.3k stars 186 forks source link

Startify adds ~100ms to VimEnter autocommand #462

Open infinite-ops opened 3 years ago

infinite-ops commented 3 years ago

Startify seems to add 100ms or so to VimEnter autocommand. When using dstein64/vim-startuptime to profile startuptime

event                time     percent
VimEnter autocommand 109.76   27.92

If I comment out "set filetype=startify" on line 161 of autoload/startify.vim VimEnter autocommand returns to normal duration

event                 time     percent
VimEnter autocommand  12.08    4.76

Is this expected or can it be improved?

mhinz commented 3 years ago

When the filetype doesn't get set, the syntax file will never be sourced, thus there won't be any colors. Setting colors in Vim is based on regular expressions and known not to be extremely fast.

So, I wouldn't say it's expected, but it's hard to improve upon.

Then again, I installed vim-startuptime and don't see nearly as much of a difference as you do. With setting the filetype, ~40ms are spent in VimEnter, without it ~33. Very much depends on the used computer, of course.

It would be interesting to see if the loading time improves for you when you comment out single :syntax lines in this range: https://github.com/mhinz/vim-startify/blob/6654e37a1eaa2f0f257ef7a3784dd9f4f42c3bef/syntax/startify.vim#L16-L41

Assuming there is a single expensive regexp being the culprit here, maybe we could improve upon it.

infinite-ops commented 3 years ago

hi @mhinz, commenting all of those out saved ~5-8ms over all but not much. I rechecked and commenting out the filetype still drops it by ~100ms. thanks for taking the time to investigate. Its not the end of the world, just thought I'd raise it in case it was something overlooked or a quick fix. Same behavior with vim 8.2 and neovim 0.5 nightly

I can live the minor hit given then convenience the plugin provides, thank you!