Skip to content

Commit a303368

Browse files
AdamMajerbmeck
authored andcommitted
benchmark: filter non-present deps from start-cli-version
PR-URL: nodejs#51746 Refs: nodejs#51146 Refs: nodejs#50684 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 4f3bd62 commit a303368

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

benchmark/misc/startup-cli-version.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ const path = require('path');
99
// tends to be minimal and fewer operations are done to generate
1010
// these so that the startup cost is still dominated by a more
1111
// indispensible part of the CLI.
12+
// NOTE: not all tools are present in tarball hence need to filter
13+
const availableCli = [
14+
'tools/node_modules/eslint/bin/eslint.js',
15+
'deps/npm/bin/npx-cli.js',
16+
'deps/npm/bin/npm-cli.js',
17+
'deps/corepack/dist/corepack.js',
18+
].filter((cli) => existsSync(path.resolve(__dirname, '../../', cli)));
1219
const bench = common.createBenchmark(main, {
13-
cli: [
14-
'tools/node_modules/eslint/bin/eslint.js',
15-
'deps/npm/bin/npx-cli.js',
16-
'deps/npm/bin/npm-cli.js',
17-
'deps/corepack/dist/corepack.js',
18-
],
20+
cli: availableCli,
1921
count: [30],
2022
});
2123

@@ -47,10 +49,6 @@ function spawnProcess(cli, bench, state) {
4749

4850
function main({ count, cli }) {
4951
cli = path.resolve(__dirname, '../../', cli);
50-
if (!existsSync(cli)) {
51-
return;
52-
}
53-
5452
const warmup = 3;
5553
const state = { count, finished: -warmup };
5654
spawnProcess(cli, bench, state);

0 commit comments

Comments
 (0)