vim-startify icon indicating copy to clipboard operation
vim-startify copied to clipboard

Startify adds ~100ms to VimEnter autocommand

Open infinite-ops opened this issue 4 years ago • 2 comments

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?

infinite-ops avatar Feb 14 '21 01:02 infinite-ops

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.

mhinz avatar Mar 13 '21 16:03 mhinz

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!

infinite-ops avatar Mar 14 '21 05:03 infinite-ops