aboutsummaryrefslogtreecommitdiff
path: root/benchmark/next-tick.js
blob: 9352f8dc0a98d32ccc30f2dd0d400e4ebae74f28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// run with `time node benchmark/next-tick.js`
var assert = require('assert');

var N = 1e7;
var n = 0;

process.on('exit', function() {
  assert.equal(n, N);
});

function cb() {
  n++;
}

for (var i = 0; i < N; ++i) {
  process.nextTick(cb);
}