virt-column.nvim icon indicating copy to clipboard operation
virt-column.nvim copied to clipboard

Startup slow on extremely large files

Open yochem opened this issue 2 years ago • 2 comments

Hi @lukas-reineke!

When opening a c source file of 600,000 lines (https://github.com/latex-lsp/tree-sitter-latex/blob/master/src/parser.c), I noticed a startup time of 27,138 milliseconds. 7576 ms of these were due to VimEnter autocmds. When I removed the require('virt-column').setup({}) line from my config, the VimEnter time was around 4 ms.

I get that this normally isn't a problem, but I was wondering if it would be possible to just draw the virtual column line for just the current viewport (I don't know if this is the right word, but I mean the lines currently visible). This would be more like the 'vim-way' of viewing a file.

Let me know what you think!

Thanks in advance for looking at this issue, Yochem

yochem avatar Jun 01 '22 11:06 yochem

Yeah.. I did not expect someone to open files this large. I thought it would be more efficient to only draw the whole buffer once, and not update on every scroll event. But I can change it.

lukas-reineke avatar Jun 02 '22 01:06 lukas-reineke

Maybe it would be possible to have 2 modes; whole buffer and every scroll event and switch modes if the file is larger than, for example, 10000 lines?

yochem avatar Jun 03 '22 14:06 yochem