mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
moving benchmarks out of './src':
Harder than I thought for several reasons: - need access to common to tests the subparts, thus the unified tsconfig in tests does not work (need the path translation to those parts) - moving next to src I cannot use direct imports anymore (source files are out of rootDir), thus have to rely on d.ts files in out which is quite suboptimal as many parts do not expose the declaration files (can only type Terminal as any atm) - compiler output has to resemble the '../out/..' import logic of the TS files or require fails, thus moved the ouput to './benchmark' for now Conclusion: Not yet there, maybe not a good idea at all to move those tests out of './src' as they heavily rely on not exported internals. Needs more fiddling with the repo structure.
This commit is contained in:
+3
-3
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
import { perfContext, before, beforeEach, ThroughputRuntimeCase } from 'xterm-benchmark';
|
||||
|
||||
import { EscapeSequenceParser } from 'core/parser/EscapeSequenceParser';
|
||||
import { C0, C1 } from 'common/data/EscapeSequences';
|
||||
import { IDcsHandler } from './Types';
|
||||
import { EscapeSequenceParser } from '../out/common/parser/EscapeSequenceParser';
|
||||
import { C0, C1 } from '../out/common/data/EscapeSequences';
|
||||
import { IDcsHandler } from '../out/common/parser/Types';
|
||||
|
||||
|
||||
function toUtf32(s: string): Uint32Array {
|
||||
@@ -5,19 +5,22 @@
|
||||
|
||||
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
|
||||
|
||||
import { Terminal } from 'Terminal';
|
||||
import { spawn } from 'node-pty';
|
||||
import { Utf8ToUtf32, stringFromCodePoint } from 'core/input/TextDecoder';
|
||||
import { Utf8ToUtf32, stringFromCodePoint } from '../out/common/input/TextDecoder';
|
||||
|
||||
const Terminal: any = require('../out/Terminal').Terminal;
|
||||
|
||||
class TestTerminal extends Terminal {
|
||||
constructor(opts: any) {
|
||||
super(opts);
|
||||
}
|
||||
writeSync(data: string): void {
|
||||
this.writeBuffer.push(data);
|
||||
this._innerWrite();
|
||||
(this as any)._innerWrite();
|
||||
}
|
||||
writeSyncUtf8(data: Uint8Array): void {
|
||||
this.writeBufferUtf8.push(data);
|
||||
this._innerWriteUtf8();
|
||||
(this as any).writeBufferUtf8.push(data);
|
||||
(this as any)._innerWriteUtf8();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +36,7 @@ perfContext('Terminal: ls -lR /usr', () => {
|
||||
rows: 25,
|
||||
cwd: process.env.HOME,
|
||||
env: process.env,
|
||||
encoding: null
|
||||
encoding: (null as unknown as string) // needs to be fixed in node-pty
|
||||
});
|
||||
const chunks: Buffer[] = [];
|
||||
let length = 0;
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"evalConfig": {
|
||||
"tolerance": {
|
||||
"*": [0.75, 1.5],
|
||||
"*.dev": [0.01, 1.5],
|
||||
"*.cv": [0.01, 1.5],
|
||||
"EscapeSequenceParser.benchmark.js.*.averageThroughput.mean": [0.9, 5]
|
||||
},
|
||||
"skip": [
|
||||
"*.median",
|
||||
"*.runs",
|
||||
"*.dev",
|
||||
"*.cv",
|
||||
"EscapeSequenceParser.benchmark.js.*.averageRuntime",
|
||||
"Terminal.benchmark.js.*.averageRuntime"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6",
|
||||
],
|
||||
"rootDir": ".",
|
||||
"outDir": "../benchmark",
|
||||
"types": [
|
||||
"../node_modules/@types/node"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"removeComments": true,
|
||||
"pretty": true,
|
||||
"strict": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"common/*": [ "./../out/common/*" ],
|
||||
"browser/*": [ "./../out/browser/*" ]
|
||||
},
|
||||
"declaration": true
|
||||
},
|
||||
"include": [
|
||||
"./**/*",
|
||||
"../typings/xterm.d.ts"
|
||||
]
|
||||
}
|
||||
+4
-1
@@ -7,6 +7,9 @@
|
||||
{ "path": "./addons/xterm-addon-attach/src" },
|
||||
{ "path": "./addons/xterm-addon-fit/src" },
|
||||
{ "path": "./addons/xterm-addon-search/src" },
|
||||
{ "path": "./addons/xterm-addon-web-links/src" }
|
||||
{ "path": "./addons/xterm-addon-web-links/src" },
|
||||
|
||||
// currently depends on out, thus must run as last?
|
||||
{ "path": "./benchmark-tests" },
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user