lukas-reineke / indent-blankline.nvim

Indent guides for Neovim
MIT License
4.07k stars 102 forks source link

slow call to `vim.split` #839

Closed ces42 closed 6 months ago

ces42 commented 6 months ago

Problem

This plugin is kind of slow, and one of the reasons seems to be a slow function call to vim.split inside the hot loop on line 45 of lua/ibl/indent.lua: https://github.com/lukas-reineke/indent-blankline.nvim/blob/12e92044d313c54c438bd786d11684c88f6f78cd/lua/ibl/indent.lua#L41-L49

I have no idea why this is slow, but here's a profile (using profile.nvim) image

Each call to vim.split is taking ~0.1 ms for every line on the screen, several times per second.

Neovim version (nvim -v)

0.10.0 commit f6042d5c300c00

ces42 commented 6 months ago

Actually the tracing profiler I used might be exaggerating the impact of vim.split a bit here. I tried using a sampling profiler and vim.split still shows up a lot but it's maybe only 10-15%. I still think it's worth avoiding it in the hot loop though. ibl_orig

lukas-reineke commented 6 months ago

Thanks vim.split itself isn't the problem, it's vim.validate. Validate is super slow. I made a new release that is using vim.split without validate now.