benchmark: reduce code duplication

Merge duplicate case code in child-process-params.js.

PR-URL: https://github.com/nodejs/node/pull/36568
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Rich Trott 2020-12-18 11:03:35 -08:00 committed by Anna Henningsen
parent 2070d5b524
commit fee3b89a2b
No known key found for this signature in database
GPG Key ID: A94130F0BFC8EBE9

View File

@ -82,6 +82,7 @@ function main({ n, methodName, params }) {
}
break;
case 'execFileSync':
case 'spawnSync':
switch (params) {
case 1:
bench.start();
@ -119,24 +120,5 @@ function main({ n, methodName, params }) {
break;
}
break;
case 'spawnSync':
switch (params) {
case 1:
bench.start();
for (let i = 0; i < n; i++) method(command);
bench.end(n);
break;
case 2:
bench.start();
for (let i = 0; i < n; i++) method(command, args);
bench.end(n);
break;
case 3:
bench.start();
for (let i = 0; i < n; i++) method(command, args, options);
bench.end(n);
break;
}
break;
}
}