mirror of https://github.com/nodejs/node.git
benchmark: filter non-present deps from `start-cli-version`
PR-URL: https://github.com/nodejs/node/pull/51746 Refs: https://github.com/nodejs/node/pull/51146 Refs: https://github.com/nodejs/node/pull/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>pull/34066/head
parent
c4d0229486
commit
b1515c7a6a
|
@ -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],
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue