-
Notifications
You must be signed in to change notification settings - Fork 29
/
run_benchmark.js
34 lines (27 loc) · 922 Bytes
/
run_benchmark.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const compile = require("./compile");
const pathlib = require("path");
const { benchmarkDir, nodejsDistDir, quickjsDistDir } = require("./utils");
const execSync = require("child_process").execSync;
async function run(srcFilename) {
await compile(srcFilename);
const nodejsFilePath = pathlib.join(nodejsDistDir, srcFilename);
const nodejsCommand = `node ${nodejsFilePath}`;
console.log(nodejsCommand);
const nodejsOutput = execSync(nodejsCommand).toString();
console.log(nodejsOutput);
const quickjsFilePath = pathlib.join(quickjsDistDir, srcFilename);
const quickjsCommand = `qjs ${quickjsFilePath}`;
console.log(quickjsCommand);
const qjsOutput = execSync(quickjsCommand).toString();
console.log(qjsOutput);
return {
nodejsOutput,
qjsOutput,
};
}
exports.run = run;
if (require.main === module) {
const argv = process.argv;
const srcFilename = argv[2];
run(srcFilename);
}