From 7e5cd08061dc17f38dec307ae8fc43e44b85a777 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 11 Feb 2013 22:54:27 -0800 Subject: [PATCH] bench: move next-tick to misc/next-tick-breadth --- benchmark/misc/next-tick-breadth.js | 21 +++++++++++++++++++++ benchmark/next-tick.js | 17 ----------------- 2 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 benchmark/misc/next-tick-breadth.js delete mode 100644 benchmark/next-tick.js diff --git a/benchmark/misc/next-tick-breadth.js b/benchmark/misc/next-tick-breadth.js new file mode 100644 index 0000000000..6524081443 --- /dev/null +++ b/benchmark/misc/next-tick-breadth.js @@ -0,0 +1,21 @@ + +var common = require('../common.js'); +var bench = common.createBenchmark(main, { + millions: [2] +}); + +function main(conf) { + var N = +conf.millions * 1e6; + var n = 0; + + function cb() { + n++; + if (n === N) + bench.end(n / 1e6); + } + + bench.start(); + for (var i = 0; i < N; i++) { + process.nextTick(cb); + } +} diff --git a/benchmark/next-tick.js b/benchmark/next-tick.js deleted file mode 100644 index 9352f8dc0a..0000000000 --- a/benchmark/next-tick.js +++ /dev/null @@ -1,17 +0,0 @@ -// 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); -}