Permalink
Browse files

bench: add process.nextTick() benchmark

  • Loading branch information...
1 parent f53d092 commit 5fee1ff7bce8b867fe6e1379b7777954d24f8b36 @bnoordhuis bnoordhuis committed Oct 31, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 benchmark/next-tick.js
View
@@ -0,0 +1,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);
+}

0 comments on commit 5fee1ff

Please sign in to comment.