It could be the syntax highlighting if you have that on; Vim loves to throw regexes to long lines to highlight them. Thankfully it stops at one point. I don't think treesitter using Neovim has this problem, I should test that.
I struggle to imagine how that could slow it down. In the end it shouldn't matter whether you have dozens of lines or one long wrapped line, it's still roughly the same number of tokens to parse/highlight. Though admittedly I haven't yet tried with syntax highlighting turned off to see if that's the issue.
I don’t know how the highlight engine is coded, but I do know that it’s regex based. You moslty have to try every regex on every line. And for some lines you have to try it more than once (think tags).
When it doesn’t match, it’s ok. When it does match you jave to create new structures, adjust their priorities. And for the renderer, every scrolling means reissuing the ansi excape code according to some theme.
All of this are probably bound to the number n of characters in a line. And for big n, that means a lot of operations. Emacs also struggle with long lines.
Regexes are line-based most of the time. And so the more characters you have on the line, the more work the engine has to do to parse it. I guess with greedy quantifiers you need to go to the end of the line and then match from there, and I don't think that's free. Multiply that by the crazy amount of regexes Vim native highlighting uses and the engine begins to struggle.
That being said, I didn't look at the code of the engine itself, so I don't know for sure. But I know that disabling the highlighting get rid of these kind of issues most of the time.
Replies (1)
Replies (2)
When it doesn’t match, it’s ok. When it does match you jave to create new structures, adjust their priorities. And for the renderer, every scrolling means reissuing the ansi excape code according to some theme.
All of this are probably bound to the number n of characters in a line. And for big n, that means a lot of operations. Emacs also struggle with long lines.
That being said, I didn't look at the code of the engine itself, so I don't know for sure. But I know that disabling the highlighting get rid of these kind of issues most of the time.