Neo-Async v1.5.0
Neo-Async is thought to be used as a drop-in replacement for Async, it almost fully covers its functionality and runs faster.
Async allows double callbacks in waterfall, but Neo-Async does not allow. (test)
PR is welcome ! Especially improvement for English documents :)
Installation
In a browser
<script src="async.min.js"></script>In an AMD loader
require(['async'], function(async) {});Node.js
standard
$ npm install neo-asyncvar async = require('neo-async');
// safe mode
var async = require('neo-async').safe; // avoid stack overflow if iterator is called on sync.replacement
$ npm install neo-async
$ ln -s ./node_modules/neo-async ./node_modules/asyncvar async = require('async');Bower
bower install neo-asyncFeature
* not in Async
Collections
eacheachSerieseachLimitforEach->eachforEachSeries->eachSeriesforEachLimit->eachLimiteachOf->eacheachOfSeries->eachSerieseachOfLimit->eachLimitforEachOf->eachforEachOfSeries->eachSerieseachOfLimit->forEachLimitmapmapSeriesmapLimitmapValues*mapValuesSeries*mapValuesLimit*filterfilterSeriesfilterLimitselect->filterselectSeries->filterSeriesselectLimit->filterLimitrejectrejectSeriesrejectLimitdetectdetectSeriesdetectLimitpick*pickSeries*pickLimit*reduceinject->reducefoldl->reducereduceRightfoldr->reduceRighttransform*transformSeries*transformLimit*sortBysortBySeriessortByLimit*somesomeSeriessomeLimitany->someeveryeverySeries*everyLimitall->everyconcatconcatSeriesconcatLimit*
Control Flow
parallelseriesparallelLimitwaterfallangelFall*angelfall->angelFall*whilstdoWhilstuntilforevercomposeseqapplyEachapplyEachSeriesqueuepriorityQueuecargoautoretryiteratortimestimesSeriestimesLimit
Utils
applynextTicksetImmediatesafeNextTick*asyncifywrapSync->asyncifyconstantensureAsyncmemoizeunmemoizelogdircreateLoggernoConflicteventEmitter*EventEmitter*safe*
Safe
var async = require('neo-async').safe;
// or
var async = require('neo-async');
async.safe.each(collection, iterator, callback);Speed Comparison
- async v1.3.0
- neo-async v1.3.0
Server-side
Speed comparison of server-side measured by func-comparator.
Specifications are as follows.
- n times trials
- Random execution order
- Measure the average speed[μs] of n times
execute
- 100 times trials
- 500000 tasks
Execution environment are as follows.
- node v0.10.40
- node v0.12.7
- iojs v2.3.4
$ node perf/func-comparatorresult
The value is the ratio (Neo-Async/Async) of the average speed per n times.
collections
| function | node v0.10.40 | node v0.12.7 | iojs v2.3.4 |
|---|---|---|---|
| each | 2.01 | 1.95 | 2.19 |
| eachSeries | 2.28 | 2.62 | 2.28 |
| eachLimit | 2.33 | 3.32 | 2.81 |
| eachOf | 1.93 | 1.92 | 2.12 |
| eachOfSeries | 2.17 | 2.79 | 2.98 |
| eachOfLimit | 2.03 | 1.54 | 2.57 |
| map | 3.10 | 3.11 | 3.38 |
| mapSeries | 2.36 | 1.98 | 2.32 |
| mapLimit | 1.76 | 1.84 | 2.06 |
| filter | 2.33 | 3.70 | 6.59 |
| filterSeries | 2.11 | 2.71 | 3.68 |
| reject | 2.71 | 4.38 | 7.33 |
| rejectSeries | 2.31 | 3.09 | 3.86 |
| detect | 2.31 | 2.69 | 2.92 |
| detectSeries | 2.13 | 1.96 | 2.71 |
| reduce | 2.09 | 1.94 | 2.26 |
| reduceRight | 2.19 | 1.93 | 2.51 |
| sortBy | 1.41 | 1.66 | 1.52 |
| some | 2.23 | 2.29 | 2.50 |
| every | 2.22 | 2.25 | 2.93 |
| concat | 12.0 | 7.23 | 10.0 |
| concatSeries | 8.37 | 5.15 | 8.05 |
control flow
| function | node v0.10.40 | node v0.12.7 | iojs v2.3.4 |
|---|---|---|---|
| parallel | 4.13 | 5.00 | 3.37 |
| series | 3.13 | 2.70 | 3.03 |
| parallelLimit | 2.69 | 2.96 | 2.49 |
| waterfall | 3.45 | 7.24 | 7.59 |
| whilst | 1.02 | 1.09 | 1.14 |
| doWhilst | 1.26 | 1.36 | 1.28 |
| until | 1.02 | 1.08 | 1.13 |
| doUntil | 1.25 | 1.31 | 1.34 |
| during | 2.15 | 2.08 | 2.08 |
| doDuring | 5.08 | 5.77 | 5.39 |
| times | 4.07 | 3.16 | 3.44 |
| timesSeries | 2.82 | 2.58 | 2.71 |
| timesLimit | 2.23 | 2.05 | 1.93 |