From 5fee1ff7bce8b867fe6e1379b7777954d24f8b36 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 31 Oct 2011 21:58:22 +0100 Subject: [PATCH] bench: add process.nextTick() benchmark --- benchmark/next-tick.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 benchmark/next-tick.js diff --git a/benchmark/next-tick.js b/benchmark/next-tick.js new file mode 100644 index 0000000000..9352f8dc0a --- /dev/null +++ b/benchmark/next-tick.js @@ -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); +}