3 ms·
Containment should mostly eliminate any perf benefit from reimplementing text layout in WebGL for things like text editors and terminals that typically already
by spankalee 7y ago
Containment should mostly eliminate any perf benefit from reimplementing text layout in WebGL for things like text editors and terminals that typically already break text into lines. Put contain: strict on lines, gutters, etc., and contain: content on all inline elements.
I've tried this with CodeMirror 5 and it doesn't break anything. Hopefully over time VS Code and other editors can back out their complex custom renderers.
- kevingadd 7y agoI suspect custom renderers will stick around because of the additional control over rasterization you get and the ability to rasterize from the same internal buffers that you use for editing and syntax highlighting. If a file contains tens of thousands of lines (not uncommon these days) the cost of duplicating all of that to a complex HTML+CSS tree is not insignificant, even if contain reduces the cost of it. Even now it's not hard to get the github code view of a large file to lag a bit in Firefox when scrolling it because of how much layout and rasterization has to happen (in part due to the way they aggressively syntax highlight the text and split lines into elements to include line numbers) Another example - if you haven't done it recently, try opening a 10mb+ text file in chrome or firefox. The experience is still somewhat bad.
- spankalee 7y agoThose renderers should use some kind of viewport rendering / virtualization so that they're not creating DOM for the entire document.