Neo-Async v1.0.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-async
var async = require('neo-async');
replacement
$ npm install neo-async
$ ln -s ./node_modules/neo-async ./node_modules/async
var async = require('async');
Bower
bower install neo-async
Feature
JSDoc
* not in Async
Collections
Control Flow
Utils
Speed Comparison
- async v0.9.0
- neo-async v0.6.4
- neo-async v1.0.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
sample.parllel.js
var comparator = require('func-comparator');
var _ = require('lodash');
var async = require('async');
var neo_async = require('neo-async');
var count = 100;
var times = 100000;
var array = _.shuffle(_.times(count));
var tasks = _.map(array, function() {
return function(next) {
next();
};
});
var funcs = {
'async': function(callback) {
async.parallel(tasks, callback);
},
'neo-async': function(callback) {
neo_async.parallel(tasks, callback);
}
};
comparator
.set(funcs)
.async()
.times(times)
.start()
.result(console.log);
execute
- 100 times trials
- 100000 tasks
Execution environment are as follows.
- node v0.10.38
- node v0.12.2
- iojs v1.8.1
$ gulp speed_test --file parallel
result
The value is the ratio (Neo-Async/Async) of the average speed per n times.
control flow
function | node v0.10.38 | node v0.12.2 | iojs v1.8.1 |
---|
parallel | 5.97 | 6.44 | 6.68 |
series | 6.99 | 7.82 | 7.66 |
parallelLimit | 5.56 | 4.99 | 6.15 |
waterfall | 23.38 | 33.99 | 36.93 |
times | 4.36 | 4.22 | 4.15 |
timesSeries | 5.05 | 4.32 | 3.72 |
collections
function | node v0.10.38 | node v0.12.2 | iojs v1.8.1 |
---|
each | 2.10 | 2.32 | 2.56 |
eachSeries | 1.04 | 1.22 | 1.23 |
eachLimit | 1.68 | 0.91 | 1.08 |
map | 3.90 | 4.03 | 4.56 |
mapSeries | 3.98 | 5.10 | 4.65 |
mapLimit | 3.60 | 2.85 | 3.44 |
filter | 3.21 | 3.12 | 3.26 |
filterSeries | 5.29 | 7.00 | 5.58 |
reduce | 2.05 | 1.96 | 2.49 |
reduceRight | 3.71 | 4.01 | 4.09 |
sortBy | 1.06 | 1.54 | 1.42 |
some | 2.63 | 2.64 | 3.03 |
every | 2.70 | 2.66 | 3.09 |
concat | 3.02 | 2.34 | 2.67 |
concatSeries | 2.56 | 2.42 | 2.65 |