cleaner approach

This commit is contained in:
Jörg Breitbart
2019-06-09 17:31:57 +02:00
parent 3204d9d7c9
commit e920f1db86
10 changed files with 34 additions and 112 deletions
-18
View File
@@ -1,18 +0,0 @@
{
"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"
]
}
}
-26
View File
@@ -1,26 +0,0 @@
{
"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/*" ]
}
},
"include": [
"./**/*",
"../typings/xterm.d.ts"
],
}
-55
View File
@@ -1,55 +0,0 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
const cp = require('child_process');
const path = require('path');
const glob = require('glob');
// Add `out` to the NODE_PATH so absolute paths can be resolved.
const env = { ...process.env };
env.NODE_PATH = path.resolve(__dirname, '../out');
/**
* Default commands for yarn:
* yarn benchmark single single run of all benchmarks without statistics
* yarn benchmark baseline 10 runs of all benchmarks with baseline statistics
* yarn benchmark eval 10 runs of all benchmarks with eval against last baseline
*/
const commands = {
single : '-r 5 -c ./benchmark-tests/benchmark.json',
baseline: '--baseline -r 5 -c ./benchmark-tests/benchmark.json',
eval : '--eval -r 5 -c ./benchmark-tests/benchmark.json'
}
let testFiles = [
'./benchmark/*benchmark.js'
];
// allow overriding cmdline args (see yarn benchmark --help)
if (process.argv.length === 3 && process.argv[2] in commands) {
testFiles.push(commands[process.argv[2]]);
} else if (process.argv.length > 2) {
testFiles = process.argv.slice(2);
} else if (process.argv.length === 2) {
testFiles.push(commands['single']);
}
cp.spawnSync(
path.resolve(__dirname, '../node_modules/.bin/xterm-benchmark'),
testFiles.reduce((accu, cur) => {
const expanded = glob.sync(cur);
if (!expanded.length) {
accu.push(cur);
return accu;
}
return accu.concat(expanded);
}, []),
{
cwd: path.resolve(__dirname, '..'),
env,
stdio: 'inherit',
shell: true
}
);
+3 -1
View File
@@ -20,7 +20,9 @@
"prepublishOnly": "npm run package",
"watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput",
"clean": "rm -rf lib out addons/*/lib",
"benchmark": "node ./bin/benchmark.js"
"benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c benchmark.json",
"benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c benchmark.json --baseline out/benchmark-tests/*benchmark.js",
"benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c benchmark.json --eval out/benchmark-tests/*benchmark.js"
},
"devDependencies": {
"@types/chai": "^3.4.34",
@@ -0,0 +1 @@
export {};
@@ -4,9 +4,9 @@
*/
import { perfContext, before, beforeEach, ThroughputRuntimeCase } from 'xterm-benchmark';
import { EscapeSequenceParser } from '../out/common/parser/EscapeSequenceParser';
import { C0, C1 } from '../out/common/data/EscapeSequences';
import { IDcsHandler } from '../out/common/parser/Types';
import { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';
import { C0, C1 } from 'common/data/EscapeSequences';
import { IDcsHandler } from 'common/parser/Types';
function toUtf32(s: string): Uint32Array {
+1
View File
@@ -0,0 +1 @@
export {};
@@ -6,14 +6,10 @@
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from '../out/common/input/TextDecoder';
const Terminal: any = require('../out/Terminal').Terminal;
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { Terminal } from 'Terminal';
class TestTerminal extends Terminal {
constructor(opts: any) {
super(opts);
}
writeSync(data: string): void {
this.writeBuffer.push(data);
(this as any)._innerWrite();
+23
View File
@@ -0,0 +1,23 @@
{
"extends": "../tsconfig-library-base",
"compilerOptions": {
"lib": [
"dom",
"es6",
],
"outDir": "../../out",
"types": [
"../../node_modules/@types/node"
],
"baseUrl": "..",
"strict": false
},
"include": [
"./**/*",
"../**/*",
"../../typings/xterm.d.ts"
],
"exclude": [
"../**/*test.ts"
]
}
+1 -3
View File
@@ -8,8 +8,6 @@
{ "path": "./addons/xterm-addon-fit/src" },
{ "path": "./addons/xterm-addon-search/src" },
{ "path": "./addons/xterm-addon-web-links/src" },
// currently depends on out, thus must run as last?
{ "path": "./benchmark-tests" },
{ "path": "./src/benchmark-tests" },
]
}