benchmark: (util/v8/vm) use destructuring
PR-URL: https://github.com/nodejs/node/pull/18250 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
5dfb93d2fa
commit
7a24b1c565
@ -47,11 +47,9 @@ function getInput(input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function main(conf) {
|
function main({ input, n }) {
|
||||||
const normalizeEncoding = require('internal/util').normalizeEncoding;
|
const { normalizeEncoding } = require('internal/util');
|
||||||
|
const inputs = getInput(input);
|
||||||
const n = conf.n | 0;
|
|
||||||
const inputs = getInput(conf.input);
|
|
||||||
var noDead = '';
|
var noDead = '';
|
||||||
|
|
||||||
bench.start();
|
bench.start();
|
||||||
|
@ -34,16 +34,15 @@ const bench = common.createBenchmark(main, {
|
|||||||
flags: ['--expose-internals']
|
flags: ['--expose-internals']
|
||||||
});
|
});
|
||||||
|
|
||||||
function main(conf) {
|
function main({ type, argument, version, n }) {
|
||||||
// For testing, if supplied with an empty type, default to ArrayBufferView.
|
// For testing, if supplied with an empty type, default to ArrayBufferView.
|
||||||
conf.type = conf.type || 'ArrayBufferView';
|
type = type || 'ArrayBufferView';
|
||||||
|
|
||||||
const util = process.binding('util');
|
const util = process.binding('util');
|
||||||
const types = require('internal/util/types');
|
const types = require('internal/util/types');
|
||||||
|
|
||||||
const n = (+conf.n) | 0;
|
const func = { native: util, js: types }[version][`is${type}`];
|
||||||
const func = { native: util, js: types }[conf.version][`is${conf.type}`];
|
const arg = args[type][argument];
|
||||||
const arg = args[conf.type][conf.argument];
|
|
||||||
|
|
||||||
bench.start();
|
bench.start();
|
||||||
for (var i = 0; i < n; i++) {
|
for (var i = 0; i < n; i++) {
|
||||||
|
@ -11,9 +11,7 @@ const bench = common.createBenchmark(main, {
|
|||||||
n: [1e6]
|
n: [1e6]
|
||||||
});
|
});
|
||||||
|
|
||||||
function main(conf) {
|
function main({ method, n }) {
|
||||||
const n = +conf.n;
|
|
||||||
const method = conf.method;
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
bench.start();
|
bench.start();
|
||||||
for (; i < n; i++)
|
for (; i < n; i++)
|
||||||
|
@ -10,10 +10,8 @@ const bench = common.createBenchmark(main, {
|
|||||||
|
|
||||||
const vm = require('vm');
|
const vm = require('vm');
|
||||||
|
|
||||||
function main(conf) {
|
function main({ n, breakOnSigint, withSigintListener }) {
|
||||||
const n = +conf.n;
|
const options = breakOnSigint ? { breakOnSigint: true } : {};
|
||||||
const options = conf.breakOnSigint ? { breakOnSigint: true } : {};
|
|
||||||
const withSigintListener = !!conf.withSigintListener;
|
|
||||||
|
|
||||||
process.removeAllListeners('SIGINT');
|
process.removeAllListeners('SIGINT');
|
||||||
if (withSigintListener)
|
if (withSigintListener)
|
||||||
|
@ -10,10 +10,8 @@ const bench = common.createBenchmark(main, {
|
|||||||
|
|
||||||
const vm = require('vm');
|
const vm = require('vm');
|
||||||
|
|
||||||
function main(conf) {
|
function main({ n, breakOnSigint, withSigintListener }) {
|
||||||
const n = +conf.n;
|
const options = breakOnSigint ? { breakOnSigint: true } : {};
|
||||||
const options = conf.breakOnSigint ? { breakOnSigint: true } : {};
|
|
||||||
const withSigintListener = !!conf.withSigintListener;
|
|
||||||
|
|
||||||
process.removeAllListeners('SIGINT');
|
process.removeAllListeners('SIGINT');
|
||||||
if (withSigintListener)
|
if (withSigintListener)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user