Add load test for long lines
This commit is contained in:
@@ -235,6 +235,7 @@ if (document.location.pathname === '/test') {
|
|||||||
document.getElementById('htmlserialize').addEventListener('click', htmlSerializeButtonHandler);
|
document.getElementById('htmlserialize').addEventListener('click', htmlSerializeButtonHandler);
|
||||||
document.getElementById('custom-glyph').addEventListener('click', writeCustomGlyphHandler);
|
document.getElementById('custom-glyph').addEventListener('click', writeCustomGlyphHandler);
|
||||||
document.getElementById('load-test').addEventListener('click', loadTest);
|
document.getElementById('load-test').addEventListener('click', loadTest);
|
||||||
|
document.getElementById('load-test-long-lines').addEventListener('click', loadTestLongLines);
|
||||||
document.getElementById('print-cjk').addEventListener('click', addCjk);
|
document.getElementById('print-cjk').addEventListener('click', addCjk);
|
||||||
document.getElementById('print-cjk-sgr').addEventListener('click', addCjkRandomSgr);
|
document.getElementById('print-cjk-sgr').addEventListener('click', addCjkRandomSgr);
|
||||||
document.getElementById('powerline-symbol-test').addEventListener('click', powerlineSymbolTest);
|
document.getElementById('powerline-symbol-test').addEventListener('click', powerlineSymbolTest);
|
||||||
@@ -840,6 +841,39 @@ function loadTest(): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadTestLongLines(): void {
|
||||||
|
const rendererName = addons.webgl.instance ? 'webgl' : !!addons.canvas.instance ? 'canvas' : 'dom';
|
||||||
|
const testData = [];
|
||||||
|
let byteCount = 0;
|
||||||
|
for (let i = 0; i < 50; i++) {
|
||||||
|
const count = 1 + Math.floor(Math.random() * 500);
|
||||||
|
byteCount += count + 2;
|
||||||
|
const data = new Uint8Array(count + 2);
|
||||||
|
data[0] = 0x0A; // \n
|
||||||
|
for (let i = 1; i < count + 1; i++) {
|
||||||
|
data[i] = 0x61 + Math.floor(Math.random() * (0x7A - 0x61));
|
||||||
|
}
|
||||||
|
// End each line with \r so the cursor remains constant, this is what ls/tree do and improves
|
||||||
|
// performance significantly due to the cursor DOM element not needing to change
|
||||||
|
data[data.length - 1] = 0x0D; // \r
|
||||||
|
testData.push(data);
|
||||||
|
}
|
||||||
|
const start = performance.now();
|
||||||
|
for (let i = 0; i < 1024 * 50; i++) {
|
||||||
|
for (const d of testData) {
|
||||||
|
term.write(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Wait for all data to be parsed before evaluating time
|
||||||
|
term.write('', () => {
|
||||||
|
const time = Math.round(performance.now() - start);
|
||||||
|
const mbs = ((byteCount / 1024) * (1 / (time / 1000))).toFixed(2);
|
||||||
|
term.write(`\n\r\nWrote ${byteCount}kB in ${time}ms (${mbs}MB/s) using the (${rendererName} renderer)`);
|
||||||
|
// Send ^C to get a new prompt
|
||||||
|
term._core._onData.fire('\x03');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function powerlineSymbolTest(): void {
|
function powerlineSymbolTest(): void {
|
||||||
function s(char: string): string {
|
function s(char: string): string {
|
||||||
return `${char} \x1b[7m${char}\x1b[0m `;
|
return `${char} \x1b[7m${char}\x1b[0m `;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
|
|
||||||
<dt>Performance</dt>
|
<dt>Performance</dt>
|
||||||
<dd><button id="load-test" title="Write several MB of data to simulate a lot of data coming from the process">Load test</button></dd>
|
<dd><button id="load-test" title="Write several MB of data to simulate a lot of data coming from the process">Load test</button></dd>
|
||||||
|
<dd><button id="load-test-long-lines" title="Write several MB of data with long lines to simulate a lot of data coming from the process">Load test (long lines)</button></dd>
|
||||||
<dd><button id="print-cjk" title="Prints the 20977 characters from the CJK Unified Ideographs unicode block">CJK Unified Ideographs</button></dd>
|
<dd><button id="print-cjk" title="Prints the 20977 characters from the CJK Unified Ideographs unicode block">CJK Unified Ideographs</button></dd>
|
||||||
<dd><button id="print-cjk-sgr" title="Prints the 20977 characters from the CJK Unified Ideographs unicode block with randomized SGR attributes">CJK Unified Ideographs (random SGR)</button></dd>
|
<dd><button id="print-cjk-sgr" title="Prints the 20977 characters from the CJK Unified Ideographs unicode block with randomized SGR attributes">CJK Unified Ideographs (random SGR)</button></dd>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user