Skip to content

Commit

Permalink
Use fastbench.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Jul 14, 2015
1 parent d43c050 commit c8790e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 34 deletions.
45 changes: 11 additions & 34 deletions bench.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
var max = 100000
var series = require('fastseries')()
var async = require('async')
var insync = require('insync')
var neoAsync = require('neo-async')
var fall = require('./')()
var runWaterfall = require('run-waterfall')
var waterfallize = require('waterfallize')

function bench (func, done) {
var key = max + '*' + func.name
var count = -1

console.time(key)
end()

function end () {
if (++count < max) {
func(end)
} else {
console.timeEnd(key)
if (done) {
done()
}
}
}
}
var bench = require('fastbench')

var nextDone
var nextCount
Expand Down Expand Up @@ -84,19 +65,15 @@ function benchNeoAsync (done) {

var compiled = require('./')(toCall)

function noop () {}

function run (next) {
series(null, bench, [
benchAsyncWaterfall,
benchInsync,
benchNeoAsync,
benchFastFall,
benchRunWaterFall,
benchSetImmediate,
benchWaterfallize,
compiled
], next || noop)
}
var run = bench([
benchAsyncWaterfall,
benchInsync,
benchNeoAsync,
benchFastFall,
benchRunWaterFall,
benchSetImmediate,
benchWaterfallize,
compiled
], max)

run(run)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"homepage": "https://github.com/mcollina/fastfall#readme",
"devDependencies": {
"async": "^1.0.0",
"fastbench": "^1.0.0",
"faucet": "0.0.1",
"insync": "^1.0.0",
"neo-async": "^1.2.1",
Expand Down

0 comments on commit c8790e5

Please sign in to comment.