Improve Scroll / Performance tradeoff

CodeMirror seems to optimize performance via not rendering / removing lines from the DOM that are not in the viewport and instead replacing it with a “cm-gap” element that takes the height of the non visible elements.

Is there a way to customize or disable this behaviour? For example if I scroll fast on a large file there would often be frames with no lines rendered / scrollbar behaving eradically as a result. I assume the code uses IntersectionObserver behind the scenes, perhaps there would be a way to change the threshold / that it renders more lines outside of the viewport so that there are no empty frames?

No, there’s no way to change this. The system’s performance is designed about the viewport being of limited size, and making it bigger would make the editor less responsive.