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

Startup time

Open sudoremo opened this issue 6 years ago • 9 comments

This plugin significantly adds to my vim / nvim startup time by contributing 328ms to it. Is this a known issue / is there any way to improve this startup time?

Thanks for any help and also thanks for this wonderful plugin - it was the first vim plugin I used back when I switched from Atom! 👍

sudoremo avatar Jan 31 '18 14:01 sudoremo

This issue has not yet been reported, will need some investigation.

rakr avatar Feb 10 '18 05:02 rakr

Just bumping this issue with the results of my profiler:

vim-one load time
Vim 233.36 ms
Neovim 82.64 ms

rnevius avatar Jan 08 '19 23:01 rnevius

I think this performance hit on startup (even when the scheme isn't active) is due to the use of functions to define the colors vs. hard-coded values. It would be a non-trivial effort to rewrite those (I think this was built from the base16 generator originally), but that might be a contributor.

h/t @devinrm for the suggestion.

geoffharcourt avatar Jan 22 '19 01:01 geoffharcourt

I should clarify that I don't think this is easy, and it might reduce the comprehensiveness of the scheme, limiting the size of the group that can use it.

geoffharcourt avatar Jan 22 '19 02:01 geoffharcourt

@geoffharcourt Thx for your explanation. I just made a hard-coded fork of vim-one and the startup time improves dramatically.

# the original one
❯ vim-profiler.py -r 10 nvim
=====================================
Top 10 plugins slowing nvim's startup
=====================================
1       170.621   vim-one
2         6.274   vim-airline
3         4.038   vim-polyglot
4         3.496   coc.nvim
5         2.645   colorizer
6         2.413   vim-textobj-xmlattr
7         2.313   vim-textobj-comment
8         1.795   vim-sensible
9         1.664   vim-textobj-line
10        1.341   ctrlp.vim
=====================================

# the hard-coded
❯ vim-profiler.py -r 10 nvim
=====================================
Top 10 plugins slowing nvim's startup
=====================================
1        11.172   vim-one
2         6.650   vim-airline
3         3.960   vim-polyglot
4         3.579   coc.nvim
5         2.830   colorizer
6         2.405   vim-textobj-comment
7         2.372   vim-textobj-xmlattr
8         1.732   vim-sensible
9         1.724   vim-textobj-line
10        1.430   ctrlp.vim
=====================================

Italic setting let g:one_allow_italics = 1 is available.

laggardkernel avatar Feb 20 '19 13:02 laggardkernel

@laggardkernel did you have a script or programmatic way to do this?

geoffharcourt avatar Feb 20 '19 14:02 geoffharcourt

@geoffharcourt No, not yet.

I used command nvim -u only-for-one.vim -V20output.log to get the verbose sourcing info during nvim startup. The configuration file only-for-one.vim only included the vim-one plugin and some colorscheme settings. After that, I did some searching in the output file and extract all the related highlight statements from it.

As far as I know, it's the most simple way to convert the original project to a hard-coded color scheme. Maybe I'll restructure the code later. Haven't made up my mind.

laggardkernel avatar Feb 20 '19 15:02 laggardkernel

Thanks for your patience, thanks to @laggardkernel and the use of better approximation, this issue should now be fixed by the latest commit to master. @laggardkernel As commented on the PR, I had to manually merge the PR, Thank you very much for your contribution

rakr avatar Apr 09 '19 08:04 rakr

@rakr Thank God you're back. There's another optimization I borrowed from vim theme gruvbox that reuses highlight definitions by hi link. Maybe we could add it as well. I'll rebase it onto the master branch and open a pr once I have a spare moment.

laggardkernel avatar Apr 09 '19 08:04 laggardkernel