Startup performance

Yet another, sorry. Python plugins that are a part of the default distribution taking a long time. Here’s a comparison of starting vi and nvim, both editing a python file. Why are the python bits taking so much time?

vim....
140.498  001.400  001.400: sourcing /usr/local/share/vim/vim82/ftplugin/python.vim
145.422  001.608  001.608: sourcing /Users/glenn/.local/share/vim/plugged/vim-polyglot/indent/python.vim
146.442  000.324  000.324: sourcing /usr/local/share/vim/vim82/indent/python.vim
152.536  004.122  004.122: sourcing /Users/glenn/.local/share/vim/plugged/vim-polyglot/syntax/python.vim
153.698  000.299  000.299: sourcing /usr/local/share/vim/vim82/syntax/python.vim

nvim....
127.930  000.939  000.939: sourcing /Users/glenn/bin/nvim-osx64/share/nvim/runtime/autoload/provider/pythonx.vim
349.525  002.646  002.646: sourcing /Users/glenn/bin/nvim-osx64/share/nvim/runtime/autoload/remote/host.vim
349.678  223.779  220.194: sourcing /Users/glenn/bin/nvim-osx64/share/nvim/runtime/autoload/provider/python3.vim
478.072  128.005  128.005: sourcing /Users/glenn/bin/nvim-osx64/share/nvim/runtime/autoload/provider/python.vim
479.463  354.742  002.959: sourcing /Users/glenn/bin/nvim-osx64/share/nvim/runtime/ftplugin/python.vim
488.111  000.996  000.996: sourcing /Users/glenn/bin/nvim-osx64/share/nvim/runtime/indent/python.vim

The big part seems to be loading the python providers. Can they be turned off? Is the only consequence of turning them off that python plugins can’t be run?

1 Like

Not sure why your python providers loading so slow, but yes, you can disable them, e.g

let g:loaded_python3_provider = 0
let g:loaded_python_provider = 0

there won’t be any issue as long as you don’t have any python plugins

1 Like

I have just added a better filetype detection plugin:

GitHub - nathom/filetype.nvim: A faster version of filetype.vim just 175x faster than native vim filetype detection

This plugin is a replacement for the included filetype.vim that is sourced on startup. The purpose of that file is to create a series of autocommands that set the filetype variable depending on the filename. The issue is that creating autocommands have significant overhead, and creating 800+ of them as filetype.vim does is a very inefficient way to get the job done.

1 Like