Skip to content

Performance testing

Daniel Imms edited this page Nov 22, 2018 · 2 revisions

Automated/repeatable

https://github.com/xtermjs/xterm-benchmark is used for measuring overall performance and can drill down into specific scenarios

Manual testing

Renderer

A renderer's frame count and average frame time (ms) can be measured by adding this to the particular renderer file:

(<any>window).frames = [];
(<any>window).report = () => {
  const frames = (<any>window).frames as number[];
  const average = Math.round(frames.reduce((p, c) => p + c, 0) / frames.length * 100) / 100;
  console.log(`frames ${frames.length}, average ${average}ms`);
};

Then adding this to the top of the _renderRows function:

const startTime = performance.now();

And this above the event emit call:

(<any>window).frames.push(performance.now() - startTime);

Now compile and run the demo, get the terminal into the state before you run a command and run this in the devtools console:

window.frames = [];

Now run the command in the terminal and generate a report with:

window.report();