helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.5k stars 2.48k forks source link

`EditorView.render` always re-render(re-highlight) all opened split views #11928

Open pppKin opened 3 days ago

pppKin commented 3 days ago

Say I have 5 split views opened and I hit j to move down a line in one of them, all split views will re-render and re-highlight their content, making the editor noticeably lagging. Perhaps we should attempt to remove this redundant and unnecessary calculations

see helix-term/src/ui/editor.rs#L1502

        for (view, is_focused) in cx.editor.tree.views() {
            let doc = cx.editor.document(view.doc).unwrap();
            self.render_view(cx.editor, doc, view, area, surface, is_focused);
        }

I am not sure which part of render_view is particularly slow though. Although I suspect it's the tree-sitter highlight part, my computer has this weird encryption-anti-virus toolkit(company policy) installed that makes random things such as calling functions in DLL slow.

pascalkuthe commented 3 days ago

Likely tree sitter is slow. Only rerendering part of the screen is not feasible from an architectural standpoint, we don't have any form of damage tracking and I don't think we it's realistic to add that