dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.58k stars 1.44k forks source link

Noticable delay opening Python files I think due to `ale/cursor.vim` #3126

Open alifhughes opened 4 years ago

alifhughes commented 4 years ago

The issue

I've noticed a delay recently when opening Python files that I work on in my job. I've looked into my vim startup file and I can see noticeable delay in this line:

219.254  000.232  000.232: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/cursor.vim
451.543  000.964  000.964: sourcing /Users/alistair.hughes/.vim/plugged/coc.nvim/autoload/coc/api.vim

It seems vim/plugged/ale/autoload/ale/cursor.vim takes 200ms to load, my whole startup time is ~400/500ms so roughly half the time is spent on this. It isn't a massive deal but is one of those things I've just started to notice.

Any idea what could be causing it? (Thanks in advance!)

Vim version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb  3 2020 01:40:25)
macOS version
Included patches: 1-200

OS

MacOS Mojave 10.14.6

:ALEInfo on the file

ALEInfo
 Current Filetype: python
Available Linters: ['bandit', 'flake8', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pyls', 'pyre', 'vulture']
 Current Filetype: python
Available Linters: ['bandit', 'flake8', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pyls', 'pyre', 'vulture']
  Enabled Linters: ['flake8', 'mypy']
 Suggested Fixers:
  'add_blank_lines_for_python_control_statements' - Add blank lines before control statements.
  'autopep8' - Fix PEP8 issues with autopep8.
  'black' - Fix PEP8 issues with black.
  'isort' - Sort Python imports with isort.
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'reorder-python-imports' - Sort Python imports with reorder-python-imports.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
  'yapf' - Fix Python files with yapf.
 Linter Variables:
let g:ale_python_auto_pipenv = 0
let g:ale_python_flake8_auto_pipenv = 0
let g:ale_python_flake8_change_directory = 1
let g:ale_python_flake8_executable = 'flake8'
let g:ale_python_flake8_options = '--max-line-length=88'
let g:ale_python_flake8_use_global = 0
let g:ale_python_mypy_auto_pipenv = 0
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_ignore_invalid_syntax = 0
let g:ale_python_mypy_options = ''
let g:ale_python_mypy_show_notes = 1
let g:ale_python_mypy_use_global = 0
 Global Variables:
let g:ale_cache_executable_check_failures = 1
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace'], 'python': ['black', 'isort', 'autopep8']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'python': ['flake8', 'mypy']}
let g:ale_linters_explicit = 1
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:
(executable check - success) flake8
(finished - exit code 0) ['/bin/zsh', '-c', '''flake8'' --version']
<<<OUTPUT STARTS>>>
3.7.7 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.2 on Darwin
<<<OUTPUT ENDS>>>
(executable check - success) mypy
-- EXCLUDED ACTUAL OUTPUT AS IS SENSITIVE INFO
{{filepath}}.py'' ''{{venv}}' ''/{{filepath}}.py''']
<<<OUTPUT STARTS>>>
-- EXCLUDED ACTUAL ERRORS AS IS SENSITIVE INFO
<<<OUTPUT ENDS>>>
-- EXCLUDED ACTUAL OUTPUT END AS IS SENSITIVE INFO
<<<NO OUTPUT RETURNED>>>

Complete startup.log

times in msec
 clock   self+sourced   self:  sourced script
 clock   elapsed:              other lines

000.007  000.007: --- VIM STARTING ---
000.104  000.097: Allocated generic buffers
000.528  000.424: locale set
000.531  000.003: clipboard setup
000.541  000.010: window checked
001.128  000.587: inits 1
001.340  000.212: parsing arguments
001.343  000.003: expanding arguments
005.324  003.981: shell init
005.643  000.319: Termcap init
005.665  000.022: inits 2
005.785  000.120: init highlight
008.017  001.691  001.691: sourcing /Users/alistair.hughes/.vim/autoload/plug.vim
017.589  000.029  000.029: sourcing /Users/alistair.hughes/.vim/plugged/vim-fugitive/ftdetect/fugitive.vim
017.769  006.022  005.993: sourcing /usr/local/share/vim/vim82/filetype.vim
018.001  000.052  000.052: sourcing /usr/local/share/vim/vim82/ftplugin.vim
018.222  000.046  000.046: sourcing /usr/local/share/vim/vim82/indent.vim
019.437  000.690  000.690: sourcing /usr/local/share/vim/vim82/syntax/syncolor.vim
019.527  000.975  000.285: sourcing /usr/local/share/vim/vim82/syntax/synload.vim
019.552  001.203  000.228: sourcing /usr/local/share/vim/vim82/syntax/syntax.vim
020.097  000.151  000.151: sourcing /usr/local/share/vim/vim82/syntax/syncolor.vim
020.518  000.148  000.148: sourcing /usr/local/share/vim/vim82/syntax/syncolor.vim
020.901  000.150  000.150: sourcing /usr/local/share/vim/vim82/syntax/syncolor.vim
022.982  003.295  002.846: sourcing /Users/alistair.hughes/.vim/colors/distinguished.vim
023.432  000.204  000.204: sourcing /usr/local/Cellar/vim/8.2.0200/share/vim/vim82/syntax/nosyntax.vim
024.158  000.159  000.159: sourcing /usr/local/share/vim/vim82/syntax/syncolor.vim
024.554  000.156  000.156: sourcing /usr/local/share/vim/vim82/syntax/syncolor.vim
026.630  002.920  002.605: sourcing /Users/alistair.hughes/.vim/colors/distinguished.vim
026.719  003.116  000.196: sourcing /usr/local/share/vim/vim82/syntax/synload.vim
026.744  003.625  000.305: sourcing /usr/local/share/vim/vim82/syntax/syntax.vim
033.532  027.434  011.500: sourcing $HOME/.vimrc
033.539  000.320: sourcing vimrc file(s)
035.145  000.104  000.104: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/events.vim
035.433  001.324  001.220: sourcing /Users/alistair.hughes/.vim/plugged/ale/plugin/ale.vim
036.036  000.113  000.113: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/init.vim
036.501  000.121  000.121: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/parts.vim
037.679  000.248  000.248: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/util.vim
037.794  002.201  001.719: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/plugin/airline.vim
038.586  000.641  000.641: sourcing /Users/alistair.hughes/.vim/plugged/fzf/plugin/fzf.vim
039.616  000.871  000.871: sourcing /Users/alistair.hughes/.vim/plugged/fzf.vim/plugin/fzf.vim
039.830  000.052  000.052: sourcing /Users/alistair.hughes/.vim/plugged/vim-windowswap/plugin/WindowSwap.vim
040.071  000.090  000.090: sourcing /Users/alistair.hughes/.vim/plugged/vim-tmux-navigator/plugin/tmux_navigator.vim
041.815  001.595  001.595: sourcing /Users/alistair.hughes/.vim/plugged/vim-fugitive/plugin/fugitive.vim
042.177  000.186  000.186: sourcing /Users/alistair.hughes/.vim/plugged/tlib_vim/plugin/02tlib.vim
042.610  000.057  000.057: sourcing /Users/alistair.hughes/.vim/plugged/vim-addon-mw-utils/autoload/funcref.vim
042.871  000.505  000.448: sourcing /Users/alistair.hughes/.vim/plugged/vim-snipmate/plugin/snipMate.vim
043.066  000.032  000.032: sourcing /Users/alistair.hughes/.vim/plugged/vim-snippets/plugin/vimsnippets.vim
043.342  000.124  000.124: sourcing /Users/alistair.hughes/.vim/plugged/vim-livedown/plugin/livedown.vim
043.812  000.115  000.115: sourcing /Users/alistair.hughes/.vim/plugged/coc.nvim/autoload/coc/rpc.vim
044.602  000.608  000.608: sourcing /Users/alistair.hughes/.vim/plugged/coc.nvim/autoload/coc/util.vim
045.116  000.207  000.207: sourcing /Users/alistair.hughes/.vim/plugged/coc.nvim/autoload/coc/client.vim
048.829  005.332  004.402: sourcing /Users/alistair.hughes/.vim/plugged/coc.nvim/plugin/coc.vim
050.276  000.183  000.183: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/autoload/nerdtree.vim
051.898  000.760  000.760: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/path.vim
052.385  000.201  000.201: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/menu_controller.vim
052.755  000.112  000.112: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/menu_item.vim
053.156  000.148  000.148: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/key_map.vim
053.724  000.312  000.312: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/bookmark.vim
054.303  000.336  000.336: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/tree_file_node.vim
055.196  000.616  000.616: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/tree_dir_node.vim
055.913  000.424  000.424: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/opener.vim
056.586  000.358  000.358: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/creator.vim
056.926  000.074  000.074: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/flag_set.vim
057.389  000.207  000.207: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/nerdtree.vim
058.389  000.746  000.746: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/ui.vim
058.701  000.042  000.042: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/event.vim
059.071  000.105  000.105: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/lib/nerdtree/notifier.vim
060.660  001.279  001.279: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/autoload/nerdtree/ui_glue.vim
064.732  000.161  000.161: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/nerdtree_plugin/exec_menuitem.vim
066.048  001.201  001.201: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/nerdtree_plugin/fs_menu.vim
066.300  000.106  000.106: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/nerdtree_plugin/vcs.vim
066.568  017.413  010.042: sourcing /Users/alistair.hughes/.vim/plugged/nerdtree/plugin/NERD_tree.vim
074.251  007.454  007.454: sourcing /Users/alistair.hughes/.vim/plugged/nerdcommenter/plugin/NERD_commenter.vim
074.594  000.037  000.037: sourcing /Users/alistair.hughes/.vim/plugged/goyo.vim/plugin/goyo.vim
075.158  000.329  000.329: sourcing /Users/alistair.hughes/.vim/plugged/vim-floaterm/plugin/floaterm.vim
076.068  000.106  000.106: sourcing /usr/local/share/vim/vim82/plugin/getscriptPlugin.vim
076.618  000.449  000.449: sourcing /usr/local/share/vim/vim82/plugin/gzip.vim
077.090  000.370  000.370: sourcing /usr/local/share/vim/vim82/plugin/logiPat.vim
077.236  000.046  000.046: sourcing /usr/local/share/vim/vim82/plugin/manpager.vim
077.599  000.269  000.269: sourcing /usr/local/share/vim/vim82/plugin/matchparen.vim
078.630  000.927  000.927: sourcing /usr/local/share/vim/vim82/plugin/netrwPlugin.vim
078.773  000.020  000.020: sourcing /usr/local/share/vim/vim82/plugin/rrhelper.vim
078.924  000.037  000.037: sourcing /usr/local/share/vim/vim82/plugin/spellfile.vim
079.251  000.219  000.219: sourcing /usr/local/share/vim/vim82/plugin/tarPlugin.vim
079.526  000.155  000.155: sourcing /usr/local/share/vim/vim82/plugin/tohtml.vim
079.928  000.278  000.278: sourcing /usr/local/share/vim/vim82/plugin/vimballPlugin.vim
080.370  000.310  000.310: sourcing /usr/local/share/vim/vim82/plugin/zipPlugin.vim
080.677  000.026  000.026: sourcing /usr/local/opt/fzf/plugin/fzf.vim
080.684  005.747: loading plugins
081.362  000.314  000.314: sourcing /Users/alistair.hughes/.vim/pack/tpope/start/vim-vinegar/plugin/vinegar.vim
081.500  000.502: loading packages
082.169  000.379  000.379: sourcing /Users/alistair.hughes/.vim/plugged/vim-snipmate/after/plugin/snipMate.vim
082.208  000.329: loading after plugins
082.232  000.024: inits 3
086.620  004.388: reading viminfo
086.668  000.048: setting raw mode
086.705  000.037: start termcap
086.778  000.073: clearing screen
094.407  001.143  001.143: sourcing /usr/local/share/vim/vim82/ftplugin/python.vim
095.776  000.280  000.280: sourcing /usr/local/share/vim/vim82/indent/python.vim
097.652  001.010  001.010: sourcing /usr/local/share/vim/vim82/syntax/python.vim
098.722  000.568  000.568: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions.vim
099.058  000.101  000.101: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/quickfix.vim
099.641  000.373  000.373: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline.vim
099.991  000.063  000.063: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/netrw.vim
100.649  000.134  000.134: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/section.vim
101.386  000.418  000.418: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/highlighter.vim
101.675  001.434  000.882: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/term.vim
102.207  000.212  000.212: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/hunks.vim
103.001  000.445  000.445: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/branch.vim
103.405  000.098  000.098: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/fugitiveline.vim
103.903  000.183  000.183: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/ale.vim
104.592  000.097  000.097: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/coc.vim
105.185  000.273  000.273: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/whitespace.vim
105.901  000.185  000.185: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/wordcount.vim
106.289  000.044  000.044: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/keymap.vim
106.597  000.062  000.062: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/windowswap.vim
120.563  000.119  000.119: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/themes.vim
121.078  000.913  000.794: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/themes/dark.vim
141.156  000.233  000.233: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/builder.vim
141.693  000.119  000.119: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/extensions/default.vim
161.378  000.381  000.381: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale.vim
162.373  000.679  000.679: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/util.vim
163.374  000.701  000.701: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/linter.vim
164.801  000.685  000.685: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/bandit.vim
165.429  000.485  000.485: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/flake8.vim
166.024  000.462  000.462: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/mypy.vim
166.569  000.413  000.413: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/prospector.vim
167.123  000.421  000.421: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/pycodestyle.vim
167.670  000.416  000.416: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/pydocstyle.vim
168.196  000.392  000.392: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/pyflakes.vim
168.924  000.580  000.580: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/pylama.vim
169.570  000.508  000.508: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/pylint.vim
170.435  000.669  000.669: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/pyls.vim
171.253  000.647  000.647: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/pyre.vim
172.148  000.690  000.690: sourcing /Users/alistair.hughes/.vim/plugged/ale/ale_linters/python/vulture.vim
174.407  000.914  000.914: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/engine.vim
175.125  000.471  000.471: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/command.vim
175.905  000.229  000.229: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/python.vim
176.722  000.526  000.526: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/path.vim
181.678  000.104  000.104: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/history.vim
188.250  000.116  000.116: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/semver.vim
189.040  000.446  000.446: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/job.vim
217.117  111.568: opening buffers
217.705  000.588: BufEnter autocommands
217.716  000.011: editing files in windows
218.570  000.854: VimEnter autocommands
218.575  000.005: before starting main loop
219.254  000.232  000.232: sourcing /Users/alistair.hughes/.vim/plugged/ale/autoload/ale/cursor.vim
451.543  000.964  000.964: sourcing /Users/alistair.hughes/.vim/plugged/coc.nvim/autoload/coc/api.vim
464.752  007.417  007.417: sourcing /Users/alistair.hughes/.vim/plugged/vim-fugitive/autoload/fugitive.vim
466.048  000.360  000.360: sourcing /Users/alistair.hughes/.vim/plugged/vim-airline/autoload/airline/async.vim
469.058  000.149  000.149: sourcing /Users/alistair.hughes/.vim/plugged/vim-windowswap/autoload/WindowSwap.vim
489.270  261.573: first screen update
489.272  000.002: --- VIM STARTED ---
Jorenar commented 1 year ago

Hi @alifhughes! Since it was over three years since the report, could you please verify if the issue still appears?