Skip to content

Commit e102d80

Browse files
BridgeARMayaLekova
authored andcommitted
benchmark: (timers) use destructuring
PR-URL: nodejs#18250 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 95026c1 commit e102d80

11 files changed

+23
-23
lines changed

benchmark/timers/immediate.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const bench = common.createBenchmark(main, {
66
type: ['depth', 'depth1', 'breadth', 'breadth1', 'breadth4', 'clear']
77
});
88

9-
function main(conf) {
10-
const N = +conf.thousands * 1e3;
11-
switch (conf.type) {
9+
function main({ thousands, type }) {
10+
const N = thousands * 1e3;
11+
switch (type) {
1212
case 'depth':
1313
depth(N);
1414
break;

benchmark/timers/set-immediate-breadth-args.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
55
millions: [5]
66
});
77

8-
function main(conf) {
9-
const N = +conf.millions * 1e6;
8+
function main({ millions }) {
9+
const N = millions * 1e6;
1010

1111
process.on('exit', function() {
1212
bench.end(N / 1e6);

benchmark/timers/set-immediate-breadth.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
55
millions: [10]
66
});
77

8-
function main(conf) {
9-
const N = +conf.millions * 1e6;
8+
function main({ millions }) {
9+
const N = millions * 1e6;
1010

1111
process.on('exit', function() {
1212
bench.end(N / 1e6);

benchmark/timers/set-immediate-depth-args.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
55
millions: [5]
66
});
77

8-
function main(conf) {
9-
const N = +conf.millions * 1e6;
8+
function main({ millions }) {
9+
const N = millions * 1e6;
1010

1111
process.on('exit', function() {
1212
bench.end(N / 1e6);

benchmark/timers/timers-breadth.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
55
thousands: [5000],
66
});
77

8-
function main(conf) {
9-
const N = +conf.thousands * 1e3;
8+
function main({ thousands }) {
9+
const N = thousands * 1e3;
1010
var n = 0;
1111
bench.start();
1212
function cb() {

benchmark/timers/timers-cancel-pooled.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
66
millions: [5],
77
});
88

9-
function main(conf) {
10-
const iterations = +conf.millions * 1e6;
9+
function main({ millions }) {
10+
const iterations = millions * 1e6;
1111

1212
var timer = setTimeout(() => {}, 1);
1313
for (var i = 0; i < iterations; i++) {

benchmark/timers/timers-cancel-unpooled.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
66
millions: [1],
77
});
88

9-
function main(conf) {
10-
const iterations = +conf.millions * 1e6;
9+
function main({ millions }) {
10+
const iterations = millions * 1e6;
1111

1212
const timersList = [];
1313
for (var i = 0; i < iterations; i++) {

benchmark/timers/timers-depth.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
55
thousands: [1],
66
});
77

8-
function main(conf) {
9-
const N = +conf.thousands * 1e3;
8+
function main({ thousands }) {
9+
const N = thousands * 1e3;
1010
var n = 0;
1111
bench.start();
1212
setTimeout(cb, 1);

benchmark/timers/timers-insert-pooled.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
55
millions: [5],
66
});
77

8-
function main(conf) {
9-
const iterations = +conf.millions * 1e6;
8+
function main({ millions }) {
9+
const iterations = millions * 1e6;
1010

1111
bench.start();
1212

benchmark/timers/timers-insert-unpooled.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
66
millions: [1],
77
});
88

9-
function main(conf) {
10-
const iterations = +conf.millions * 1e6;
9+
function main({ millions }) {
10+
const iterations = millions * 1e6;
1111

1212
const timersList = [];
1313

benchmark/timers/timers-timeout-pooled.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const bench = common.createBenchmark(main, {
88
millions: [10],
99
});
1010

11-
function main(conf) {
12-
const iterations = +conf.millions * 1e6;
11+
function main({ millions }) {
12+
const iterations = millions * 1e6;
1313
let count = 0;
1414

1515
// Function tracking on the hidden class in V8 can cause misleading

0 commit comments

Comments
 (0)