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:
@@ -20,7 +20,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
||||
private _scaledCharLeft: number = 0;
|
||||
private _scaledCharTop: number = 0;
|
||||
|
||||
private _charAtlas: BaseCharAtlas;
|
||||
protected _charAtlas: BaseCharAtlas;
|
||||
|
||||
constructor(
|
||||
private _container: HTMLElement,
|
||||
|
||||
Reference in New Issue
Block a user