Skip to content

Commit

Permalink
benchmark: (timers) use destructuring
Browse files Browse the repository at this point in the history
PR-URL: #18250
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
BridgeAR authored and evanlucas committed Jan 30, 2018
1 parent 3e3254a commit 11d6458
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions benchmark/timers/immediate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/set-immediate-breadth-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/set-immediate-breadth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/set-immediate-depth-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/timers-breadth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/timers-cancel-pooled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/timers-cancel-unpooled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/timers-depth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/timers-insert-pooled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/timers-insert-unpooled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down
4 changes: 2 additions & 2 deletions benchmark/timers/timers-timeout-pooled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 11d6458

Please sign in to comment.