summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmark/async_hooks/gc-tracking.js6
-rw-r--r--benchmark/cluster/echo.js19
-rw-r--r--benchmark/dns/lookup.js7
-rw-r--r--benchmark/domain/domain-fn-args.js8
-rw-r--r--benchmark/module/module-loader.js10
5 files changed, 20 insertions, 30 deletions
diff --git a/benchmark/async_hooks/gc-tracking.js b/benchmark/async_hooks/gc-tracking.js
index c71c1b07aa..a569fb8fa9 100644
--- a/benchmark/async_hooks/gc-tracking.js
+++ b/benchmark/async_hooks/gc-tracking.js
@@ -21,10 +21,8 @@ function endAfterGC(n) {
});
}
-function main(conf) {
- const n = +conf.n;
-
- switch (conf.method) {
+function main({ n, method }) {
+ switch (method) {
case 'trackingEnabled':
bench.start();
for (let i = 0; i < n; i++) {
diff --git a/benchmark/cluster/echo.js b/benchmark/cluster/echo.js
index 07096d251d..90ae7f9fb0 100644
--- a/benchmark/cluster/echo.js
+++ b/benchmark/cluster/echo.js
@@ -10,22 +10,19 @@ if (cluster.isMaster) {
n: [1e5]
});
- function main(conf) {
- const n = +conf.n;
- const workers = +conf.workers;
- const sends = +conf.sendsPerBroadcast;
- const expectedPerBroadcast = sends * workers;
- var payload;
+ function main({ n, workers, sendsPerBroadcast, payload }) {
+ const expectedPerBroadcast = sendsPerBroadcast * workers;
var readies = 0;
var broadcasts = 0;
var msgCount = 0;
+ var data;
- switch (conf.payload) {
+ switch (payload) {
case 'string':
- payload = 'hello world!';
+ data = 'hello world!';
break;
case 'object':
- payload = { action: 'pewpewpew', powerLevel: 9001 };
+ data = { action: 'pewpewpew', powerLevel: 9001 };
break;
default:
throw new Error('Unsupported payload type');
@@ -51,8 +48,8 @@ if (cluster.isMaster) {
}
for (id in cluster.workers) {
const worker = cluster.workers[id];
- for (var i = 0; i < sends; ++i)
- worker.send(payload);
+ for (var i = 0; i < sendsPerBroadcast; ++i)
+ worker.send(data);
}
}
diff --git a/benchmark/dns/lookup.js b/benchmark/dns/lookup.js
index bb562d528c..3cc228c566 100644
--- a/benchmark/dns/lookup.js
+++ b/benchmark/dns/lookup.js
@@ -9,13 +9,10 @@ const bench = common.createBenchmark(main, {
n: [5e6]
});
-function main(conf) {
- const name = conf.name;
- const n = +conf.n;
- const all = conf.all === 'true' ? true : false;
+function main({ name, n, all }) {
var i = 0;
- if (all) {
+ if (all === 'true') {
const opts = { all: true };
bench.start();
(function cb() {
diff --git a/benchmark/domain/domain-fn-args.js b/benchmark/domain/domain-fn-args.js
index 0b98d17674..fe912e34d2 100644
--- a/benchmark/domain/domain-fn-args.js
+++ b/benchmark/domain/domain-fn-args.js
@@ -3,17 +3,15 @@ const common = require('../common.js');
const domain = require('domain');
const bench = common.createBenchmark(main, {
- arguments: [0, 1, 2, 3],
+ args: [0, 1, 2, 3],
n: [10]
});
const bdomain = domain.create();
const gargs = [1, 2, 3];
-function main(conf) {
-
- const n = +conf.n;
- const myArguments = gargs.slice(0, conf.arguments);
+function main({ n, args }) {
+ const myArguments = gargs.slice(0, args);
bench.start();
bdomain.enter();
diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js
index cca5fc2c22..8393d1f92e 100644
--- a/benchmark/module/module-loader.js
+++ b/benchmark/module/module-loader.js
@@ -12,8 +12,8 @@ const bench = common.createBenchmark(main, {
useCache: ['true', 'false']
});
-function main(conf) {
- const n = +conf.thousands * 1e3;
+function main({ thousands, fullPath, useCache }) {
+ const n = thousands * 1e3;
refreshTmpDir();
try { fs.mkdirSync(benchmarkDirectory); } catch (e) {}
@@ -30,10 +30,10 @@ function main(conf) {
);
}
- if (conf.fullPath === 'true')
- measureFull(n, conf.useCache === 'true');
+ if (fullPath === 'true')
+ measureFull(n, useCache === 'true');
else
- measureDir(n, conf.useCache === 'true');
+ measureDir(n, useCache === 'true');
refreshTmpDir();
}