Add a per-frame limit on dynamic atlas writes

This limits the amount of damage a pathological program can cause in
thrashing the LRU cache.

I ran the script described here:
https://github.com/xtermjs/xterm.js/pull/1327#issuecomment-374003960

Without this patch, the entire output would get drawn in one frame that
took about 140 ms to draw. With this patch, it takes about 60 ms. It's
still nowhere as good as the static or none atlas implementations, but
it's not terrible, like it was.

This should have minimal impact on real-world applications: it'll just
take a little longer for the atlas to warm up.

The implementation is a little hacky, since it involves throwing some
code into TextRenderLayer that violates the separation of concerns, but
we can clean this up later.
This commit is contained in:
Benjamin Woodruff
2018-04-15 20:02:39 -07:00
parent 1f692ed047
commit 5a05db727c
4 changed files with 28 additions and 2 deletions
+2
View File
@@ -54,6 +54,8 @@ export class TextRenderLayer extends BaseRenderLayer {
return;
}
this._charAtlas.beginFrame();
for (let y = startRow; y <= endRow; y++) {
const row = y + terminal.buffer.ydisp;
const line = terminal.buffer.lines.get(row);