Skip to content

Commit

Permalink
benchmark: filter non-present deps from start-cli-version
Browse files Browse the repository at this point in the history
PR-URL: #51746
Refs: #51146
Refs: #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>
  • Loading branch information
AdamMajer authored and marco-ippolito committed Jun 17, 2024
1 parent 0f14c42 commit f9688ab
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions benchmark/misc/startup-cli-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ const path = require('path');
// tends to be minimal and fewer operations are done to generate
// these so that the startup cost is still dominated by a more
// indispensible part of the CLI.
// NOTE: not all tools are present in tarball hence need to filter
const availableCli = [
'tools/node_modules/eslint/bin/eslint.js',
'deps/npm/bin/npx-cli.js',
'deps/npm/bin/npm-cli.js',
'deps/corepack/dist/corepack.js',
].filter((cli) => existsSync(path.resolve(__dirname, '../../', cli)));
const bench = common.createBenchmark(main, {
cli: [
'tools/node_modules/eslint/bin/eslint.js',
'deps/npm/bin/npx-cli.js',
'deps/npm/bin/npm-cli.js',
'deps/corepack/dist/corepack.js',
],
cli: availableCli,
count: [30],
});

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

function main({ count, cli }) {
cli = path.resolve(__dirname, '../../', cli);
if (!existsSync(cli)) {
return;
}

const warmup = 3;
const state = { count, finished: -warmup };
spawnProcess(cli, bench, state);
Expand Down

0 comments on commit f9688ab

Please sign in to comment.