fastfall
call your callbacks in a waterfall, without overhead
Benchmark for doing 3 calls setImmediate
100 thousands times:
- non-reusable setImmediate: 407ms
- async.waterfall: 1203ms
- run-waterfall: 1432ms
- insync.wasterfall: 1570ms
- neo-async.wasterfall: 445ms
- waterfallize: 757ms
fastfall
: 432msfastfall
compiled: 428ms
These benchmarks where taken via bench.js
on node 4.2.2, on a MacBook
Pro Retina 2014 (i7, 16GB of RAM).
If you need zero-overhead series function call, check out fastseries, for parallel calls check out fastparallel, and for a fast work queue use fastq.
Install
npm install fastfall --save
Usage
var fall =
You can also set this
when you create a fall:
var that = hello: 'world' var fall = that { console console } { console } { console } { console}
You can also set this
when you run a task:
var that = hello: 'world' var fall = { thisvalue = value} { console console } { console } { console }
Compile a waterfall
var fall = { console } { console } { console } // a compiled fall supports arguments too!
You can set this
by doing:
var that = hello: 'world' var fall = that { console console } { console } { console } // a compiled fall supports arguments too!
or you can simply attach it to an object:
var that = hello: 'world' thatdoSomething = { console console } { console } { console } // a compiled fall supports arguments too!that
API
fastfall([this], [functions])
Creates a fall
, it can either be pre-filled with a this
value
and an array of functions.
If there is no list of functions, a not-compiled fall is returned, if there is a list of function a compiled fall is returned.
fall([this], functions, [done])
Calls the functions in a waterfall, forwarding the arguments from one to
another. Calls done
when it has finished.
fall(args..., [done])
Calls the compiled functions in a waterfall, forwarding the arguments from one to
another. Additionally, a user can specify some arguments for the first
function, too. Calls done
when it has finished.
License
MIT