tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal
https://www.vim.org/scripts/script.php?script_id=2975
20.03k stars 1.01k forks source link

Slow fugitive#filereadable #2310

Closed SolaWing closed 5 months ago

SolaWing commented 5 months ago

I work on a large repo, and Found that show commit is very slow. I profile vim and found the time cost on git ls-tree, which take several seconds on each call, and is called by fugitive#filereadable, and which is called from other plugin like vim-projectionist, vim-bundler, vim-rails, . following is a profile on show commit from status window:

fugitive-profile.log

As filereadable is a common action to call from anywhere, this problem makes fugitive respond slowly, seriously affecting the user experience.

So my question is: can this performance be optimized to avoid getting the full tree? Or I have to find a way to adjust the caller and not call readable in the fugitive-related buffer?

tpope commented 5 months ago

Short answer is you can opt out with:

let g:fugitive_file_api = v:false

This needs to be documented, but doing that means also documenting how this API works. 🥴

So my question is: can this performance be optimized to avoid getting the full tree?

See https://github.com/tpope/vim-fugitive/discussions/1866 and https://github.com/tpope/vim-fugitive/pull/1868.