perf: partially replace .concat with .push (#13609)

This commit is contained in:
Federico Ciardi
2021-08-14 16:57:06 +02:00
committed by GitHub
parent 6a651e4641
commit 10640b2aad
18 changed files with 93 additions and 74 deletions

View File

@@ -21,7 +21,11 @@ function collect(value, previousValue): Array<string> {
const values = value.split(",");
return previousValue ? previousValue.concat(values) : values;
if (previousValue) {
previousValue.push(...values);
return previousValue;
}
return values;
}
program.option("-e, --eval [script]", "Evaluate script");
@@ -197,7 +201,7 @@ if (program.eval || program.print) {
}
// add back on node and concat the sliced args
process.argv = ["node"].concat(args);
process.argv = ["node", ...args];
process.execArgv.push(fileURLToPath(import.meta.url));
Module.runMain();

View File

@@ -8,7 +8,7 @@ import path from "path";
import child_process from "child_process";
import { fileURLToPath } from "url";
let args = [
const args = [
path.join(path.dirname(fileURLToPath(import.meta.url)), "_babel-node"),
];
@@ -69,7 +69,7 @@ getV8Flags(async function (err, v8Flags) {
// append arguments passed after --
if (argSeparator > -1) {
args = args.concat(userArgs);
args.push(...userArgs);
}
try {