forked from finos/perspective
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.js
48 lines (40 loc) · 1.51 KB
/
bench.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
require("./script_utils.js");
const execSync = require("child_process").execSync;
const execute = cmd => execSync(cmd, {stdio: "inherit"});
const args = process.argv.slice(2);
const LIMIT = args.indexOf("--limit");
const IS_DELTA = args.indexOf("--delta");
function docker() {
console.log("Creating puppeteer docker image");
let cmd = "docker run -it --rm --shm-size=2g --cap-add=SYS_NICE -u root -e PACKAGE=${PACKAGE} -e HTTPS_PROXY -e HTTPS_PROXY -v $(pwd):/src -w /src";
if (process.env.PSP_CPU_COUNT) {
cmd += ` --cpus="${parseInt(process.env.PSP_CPU_COUNT)}.0"`;
}
cmd += " perspective/puppeteer nice -n -20 node_modules/.bin/lerna exec --scope=@finos/perspective-bench -- yarn bench";
if (LIMIT !== -1) {
let limit = args[LIMIT + 1];
cmd += ` --limit ${limit}`;
}
if (IS_DELTA !== -1) {
console.log("Running benchmarking suite for delta - only comparing results within master.");
cmd += " --delta";
}
return cmd;
}
try {
if (!process.env.PSP_DOCKER_PUPPETEER) {
execute(docker());
} else {
execute(`nice -n -20 node_modules/.bin/lerna exec --scope=@finos/perspective-bench -- yarn bench`);
}
} catch (e) {
process.exit(1);
}