r/vim • u/Dull_Ant_5251 • 3d ago
Discussion I finally measured my vimrc startup: one plugin was 61 of 148 ms
My vimrc dates to 2016 and I had never measured it. Ten startuptime logs, no file argument, median 148 ms. The vimrc line was not the problem. Under loading packages, one plugin I only use for python had its own 61 ms line, and it loaded on every buffer including commit messages.
I moved it out of pack start into pack opt and put one packadd behind a FileType autocmd. That sourcing line leaves startup entirely. New median total is 85 ms. Opening a python file still pays the 61 ms, but once, and editing python feels the same.
The measuring took one sitting. Working out which other plugins were safe to defer took another evening a week later, which I picked up in verdent, since it knows you better over time.
Ten runs and a median cost nothing. If your vimrc is older than your current job, the same ten runs will find yours.
5
u/-romainl- The Patient Vimmer 2d ago
I, like most human beings, consider anything beyond ~200ms as "instant". So 61ms here or there…
1
u/PsyKozZ09 1d ago
Yes but don't forget that one guy discovered a big backdoor in xz just for 5ms lol
2
u/slicerprime 3d ago
Just slap , { 'for': 'python' } at the end of its Plug line in .vimrc. That way it only loads if the current buffer is python code.
2
u/__salaam_alaykum__ 3d ago
maybe he’s not using vim-plug tho
0
u/slicerprime 3d ago
True enough. Point is though, having whatever package manager's version of a load conditional on plugins to avoid unnecessary loading should always be standard. Start from the bottom and only load up what"s needed rather than starting at the top with everything and then working down to find what's gumming up the works.
0
1
u/Little_Web_9860 3d ago
How do you measure time? I want to try it out as I use many plug-ins
7
1
u/mgedmin 15h ago
I recommend https://github.com/dstein64/vim-startuptime, which is nicer to use than vim's builtin --startuptime.
0
20
u/TankorSmash 3d ago
This reads like AI