Open tbung opened 2 years ago
I have tested implementing some improvements. Checking if we are in cell we already highlighted before clearing the interface and rehighlighting does improve the performance massively as long as output is hidden. I'll work on cleaning that up and checking if the output should be redrawn or if it even is in the visible range next.
Great!
I remember this would be a slightly tricky thing in the code, so I had opted to do the simple thing first and then keep see what I needed to optimize. As it turned out, everything felt very snappy for me so I thought we were, surprisingly, actually fine with the naive implementation. How did you notice / how apparent are the performance issues?
https://user-images.githubusercontent.com/4084982/150780769-41dffaeb-aac5-4767-b61a-7b3899c2d53c.mp4
To be fair, I am working with a software engineerical mess of a 2500 line script with a cell with 350 lines so this is probably an edge case. As you can see in the video, scrolling gets laggy and choppy, with it keeping on scrolling after releasing j/k. As I said, with hidden output this does not happen when we only rehighlight lines if the cell span changes. I'm currently a little busy but I'll open a draft pr at the end of the week.
Is your feature request related to a problem? Please describe. Having magma enabled makes scrolling slow, especially in larger cells and files.
Describe the solution you'd like I didn't have time to look into it in more depth, but
MagmaUpdateInterface
should be made as performant as possible, maybe caching and only moving certain elements, or not be called on every curser move event. Doing slow computations asynchronous might also be possible.Describe alternatives you've considered Simply disable the autocmd.
Additional context I'll probably be able to look into it a little at the end of next week.