Profiling my startup time with nvim --startuptime vim.log
and I’m getting what looks like a horrifying 280ms!
I see there are odd plugins like Lightspeed
which are comparitively slow (7ms), but there is a big jump elsewhere, and I wanted to understand why.
For example, what’s going on here:
012.716 000.372: init default autocommands
122.037 009.536 009.536: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/tokyonight.nvim/colors/tokyonight.vim
Is that 100ms to init default autocommands? That’s nothing to do with the tokyonight colors, right? And presumably there is nothing I can do about that?
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.010 000.010: --- NVIM STARTING ---
001.565 001.555: locale set
004.384 002.819: inits 1
004.417 000.032: window checked
007.958 003.542: parsing arguments
008.461 000.503: expanding arguments
008.535 000.074: inits 2
008.990 000.455: init highlight
008.992 000.002: waiting for UI
012.288 003.296: done waiting for UI
012.319 000.031: init screen for UI
012.344 000.025: init default mappings
012.716 000.372: init default autocommands
122.037 009.536 009.536: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/tokyonight.nvim/colors/tokyonight.vim
164.096 150.211 140.675: sourcing /Users/benfrain/.config/nvim/init.lua
164.116 001.189: sourcing vimrc file(s)
165.108 000.369 000.369: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/filetype.nvim/filetype.vim
166.184 000.450 000.450: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/filetype.vim
167.463 000.614 000.614: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/ftplugin.vim
168.587 000.425 000.425: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/indent.vim
170.562 000.340 000.340: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/syntax/synload.vim
170.651 001.524 001.184: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/syntax/syntax.vim
175.949 000.401 000.401: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/gzip.vim
176.577 000.210 000.210: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/health.vim
177.045 000.129 000.129: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/man.vim
181.640 000.632 000.632: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim
182.332 004.950 004.318: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/matchit.vim
183.179 000.345 000.345: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/matchparen.vim
184.401 000.832 000.832: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/netrwPlugin.vim
185.082 000.274 000.274: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/rplugin.vim
185.623 000.163 000.163: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/shada.vim
186.096 000.122 000.122: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/spellfile.vim
186.639 000.194 000.194: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/tarPlugin.vim
187.262 000.275 000.275: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/tohtml.vim
187.732 000.117 000.117: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/tutor.vim
188.425 000.349 000.349: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/plugin/zipPlugin.vim
189.312 013.453: loading rtp plugins
192.150 000.539 000.539: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/auto-session/plugin/auto-session.vim
197.516 000.290 000.290: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/filetype.nvim/plugin/filetype.vim
199.186 000.161 000.161: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/formatter.nvim/plugin/formatter.vim
208.648 007.453 007.453: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/lightspeed.nvim/plugin/lightspeed.vim
211.637 000.325 000.325: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/lspsaga.nvim/plugin/lspsaga.vim
216.235 001.297 001.297: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/nvim-cmp/plugin/cmp.lua
217.869 000.158 000.158: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/nvim-colorizer.lua/plugin/colorizer.vim
220.036 000.339 000.339: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/nvim-lspconfig/plugin/lspconfig.vim
223.226 001.529 001.529: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/nvim-treesitter/plugin/nvim-treesitter.vim
226.530 001.066 001.066: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/nvim-ts-rainbow/plugin/rainbow.vim
228.581 000.294 000.294: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/nvim-web-devicons/plugin/nvim-web-devicons.vim
230.887 000.299 000.299: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/plenary.nvim/plugin/plenary.vim
233.679 000.504 000.504: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/targets.vim/plugin/targets.vim
236.279 000.584 000.584: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/telescope.nvim/plugin/telescope.vim
239.144 000.902 000.902: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/vim-closetag/plugin/closetag.vim
243.016 001.149 001.149: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/vim-surround/plugin/surround.vim
245.739 000.846 000.846: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/vim-vsnip/plugin/vsnip.vim
246.452 039.404: loading packages
250.705 001.019 001.019: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/cmp-vsnip/after/plugin/cmp_vsnip.vim
252.547 000.990 000.990: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/cmp-buffer/after/plugin/cmp_buffer.lua
254.556 001.262 001.262: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/cmp-look/after/plugin/cmp_look.lua
255.698 000.391 000.391: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua
257.493 000.969 000.969: sourcing /Users/benfrain/.local/share/nvim/site/pack/paqs/start/cmp-spell/after/plugin/cmp-spell.lua
257.980 006.899: loading after plugins
257.996 000.016: inits 3
264.170 006.175: reading ShaDa
265.357 001.186: opening buffers
265.441 000.085: BufEnter autocommands
265.444 000.003: editing files in windows
278.044 003.239 003.239: sourcing /Users/benfrain/.local/share/nvim/sessions/%Users%benfrain.vim
278.236 009.554: VimEnter autocommands
278.238 000.002: UIEnter autocommands
279.798 000.938 000.938: sourcing /usr/local/Cellar/neovim/HEAD-ee342d3/share/nvim/runtime/autoload/provider/clipboard.vim
279.809 000.633: before starting main loop
281.083 001.274: first screen update
281.085 000.002: --- NVIM STARTED ---
For reference, here is the full init.lua