julia-vim icon indicating copy to clipboard operation
julia-vim copied to clipboard

Slow performance with very big lines

Open ronisbr opened this issue 4 years ago • 12 comments

Hi!

I am not sure if this can be improved (it can be something related to Vim itself), but the performance while moving the cursor in the lines of this file is very bad:

https://github.com/ronisbr/PrettyTables.jl/blob/master/src/precompile/precompile_PrettyTables.jl

I need to disable syntax to be able to scroll horizontally on this file.

ronisbr avatar Apr 12 '21 23:04 ronisbr

I just pushed a commit that might help, at least a little. Could you test it? That file is quite demanding... the main problem seems to be in the abundance of parametric types (Tuples and NamedTuples, mostly). I might have an idea to improve things but it's not immediate to implement.

carlobaldassi avatar Apr 13 '21 00:04 carlobaldassi

Thanks for the fast answer @carlobaldassi ! However, this new commit did not help a lot. It is still very slow to scroll horizontally in that file. I could not notice any improvements. However, I was not able to perform a precise measurement.

ronisbr avatar Apr 13 '21 16:04 ronisbr

@ronisbr I have a branch in #254 that might still help a little bit. It certainly doesn't solve the issue. I tried a few tricks but I'm out of ideas. Basically, trying to recognize julia identifiers and operators is really expensive no matter what I try to shortcut it, and that file is especially taxing.

From what I saw, the rendering time depends a lot on how many lines are displayed. If you :set wrap for example it improves greatly.

Anyway, could you test that branch?

carlobaldassi avatar Apr 16 '21 00:04 carlobaldassi

Hi @carlobaldassi

Thanks for your work on this issue! I do see minor improvements with that branch, but it continues very, very slow. It is almost impossible to edit it. However, I really think you have done all the optimization it is possible, the problem seems to be with Vim/Neovim and my terminal.

The suggestion to use set wrap indeed helped, as you expected.

ronisbr avatar Apr 16 '21 00:04 ronisbr

Ok thanks. I have now checked this file with an older version of vim and noticed that this is very, very similar to #131: the problem is much more severe (on my laptop) with vim 8.0-1453, to the point of being nearly unusable as you said, whereas on nvim-master or vim 8.2-259 it's a bit slow but certainly usable (and with set wrap it's just fine).

carlobaldassi avatar Apr 16 '21 13:04 carlobaldassi

Hum, I will try to use nvim-master to see if I can notice improvements! Thanks for the tip :)

ronisbr avatar Apr 16 '21 14:04 ronisbr

nvim-master was a little better here, but not too much.

For your information, I found this file:

https://github.com/ronisbr/TextUserInterfaces.jl/blob/master/src/input/keycodes.jl

it is very fast to scroll horizontally, but extremely slow to scroll vertically (I see the cursor jumping randomly between lines).

ronisbr avatar Apr 19 '21 23:04 ronisbr

Same issue here (on nvim), for many pretty normal/short julia files vertical scrolling already is slow :( maybe it would make sense to have a feature-reduced variant of this syntax file that is geared towards performance?

Droggelbecher avatar May 22 '21 07:05 Droggelbecher

Have you tried setting set synmaxcol=250? The large default synmaxcol of vim/nvim generally causes slowness for syntax highlighting files with very long lines. I'm not using julia-vim anymore due to #261, so it's up to you to check whether this tip can help.

oblitum avatar May 23 '21 22:05 oblitum

@oblitum Have you tried using treesitter? (requires neovim v0.5 which is coming out this Friday!) The plugin is still required but atleast the speed issue is not to be worried about since treesitter is made with speed in mind. I've been using it and I really happy with it, considering that it gives even more highlighting (an issue that I had earlier #226).

paniash avatar Jun 30 '21 13:06 paniash

@paniash I tried tree-sitter but it seems that Julia support in tree-sitter is not good yet. Am I wrong?

ronisbr avatar Jun 30 '21 13:06 ronisbr

@paniash I tried tree-sitter but it seems that Julia support in tree-sitter is not good yet. Am I wrong?

Looks pretty good to me. It's way better than without treesitter imo.

paniash avatar Jun 30 '21 14:06 paniash