node/benchmark/process/next-tick-breadth.js
Daniele Belardi 4bf888d3d2
benchmark: use let instead of var
Use `let` in module, napi, net, os, path, process, querystring, streams
and string_decoder.

PR-URL: https://github.com/nodejs/node/pull/31592
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-13 21:41:33 +01:00

22 lines
303 B
JavaScript

'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1e7]
});
function main({ n }) {
let j = 0;
function cb() {
j++;
if (j === n)
bench.end(n);
}
bench.start();
for (let i = 0; i < n; i++) {
process.nextTick(cb);
}
}