diff options
author | isaacs <i@izs.me> | 2013-02-12 10:54:27 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-02-20 02:14:34 +0400 |
commit | 7e5cd08061dc17f38dec307ae8fc43e44b85a777 (patch) | |
tree | e1e31e4d6d4730e7db08f0709944a1be04d52aa4 /benchmark | |
parent | f7a4ccb409c14fed9c52956765c95b10bacb779a (diff) |
bench: move next-tick to misc/next-tick-breadth
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/misc/next-tick-breadth.js | 21 | ||||
-rw-r--r-- | benchmark/next-tick.js | 17 |
2 files changed, 21 insertions, 17 deletions
diff --git a/benchmark/misc/next-tick-breadth.js b/benchmark/misc/next-tick-breadth.js new file mode 100644 index 00000000000..65240814437 --- /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 9352f8dc0a9..00000000000 --- 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); -} |