benchmark: (timers) 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:
Ruben Bridgewater authored and Evan Lucas committed 2018-01-30 14:25:22 -06:00
1 parent 3e3254a2e7
commit 11d6458fd7
11 files changed
+23 -23

No files matched your search

+3 -3
View File
@@ -6,9 +6,9 @@ const bench = common.createBenchmark(main, {
type: ['depth', 'depth1', 'breadth', 'breadth1', 'breadth4', 'clear']
});
function main(conf) {
const N = +conf.thousands * 1e3;
switch (conf.type) {
function main({ thousands, type }) {
const N = thousands * 1e3;
switch (type) {
case 'depth':
depth(N);
break;
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
millions: [5]
});
function main(conf) {
const N = +conf.millions * 1e6;
function main({ millions }) {
const N = millions * 1e6;
process.on('exit', function() {
bench.end(N / 1e6);
+2 -2
View File
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
millions: [10]
});
function main(conf) {
const N = +conf.millions * 1e6;
function main({ millions }) {
const N = millions * 1e6;
process.on('exit', function() {
bench.end(N / 1e6);
+2 -2
View File
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
millions: [5]
});
function main(conf) {
const N = +conf.millions * 1e6;
function main({ millions }) {
const N = millions * 1e6;
process.on('exit', function() {
bench.end(N / 1e6);
+2 -2
View File
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
thousands: [5000],
});
function main(conf) {
const N = +conf.thousands * 1e3;
function main({ thousands }) {
const N = thousands * 1e3;
var n = 0;
bench.start();
function cb() {
+2 -2
View File
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
millions: [5],
});
function main(conf) {
const iterations = +conf.millions * 1e6;
function main({ millions }) {
const iterations = millions * 1e6;
var timer = setTimeout(() => {}, 1);
for (var i = 0; i < iterations; i++) {
+2 -2
View File
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
millions: [1],
});
function main(conf) {
const iterations = +conf.millions * 1e6;
function main({ millions }) {
const iterations = millions * 1e6;
const timersList = [];
for (var i = 0; i < iterations; i++) {
+2 -2
View File
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
thousands: [1],
});
function main(conf) {
const N = +conf.thousands * 1e3;
function main({ thousands }) {
const N = thousands * 1e3;
var n = 0;
bench.start();
setTimeout(cb, 1);
+2 -2
View File
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
millions: [5],
});
function main(conf) {
const iterations = +conf.millions * 1e6;
function main({ millions }) {
const iterations = millions * 1e6;
bench.start();
+2 -2
View File
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
millions: [1],
});
function main(conf) {
const iterations = +conf.millions * 1e6;
function main({ millions }) {
const iterations = millions * 1e6;
const timersList = [];
+2 -2
View File
@@ -8,8 +8,8 @@ const bench = common.createBenchmark(main, {
millions: [10],
});
function main(conf) {
const iterations = +conf.millions * 1e6;
function main({ millions }) {
const iterations = millions * 1e6;
let count = 0;
// Function tracking on the hidden class in V8 can cause misleading