mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
246 B
18 lines
246 B
13 years ago
|
// 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);
|
||
|
}
|