async.js vs normal execution (v2)

Revision 2 of this benchmark created on


Description

Testing the performance off a method with and without async.js

Preparation HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/async/0.7.0/async.js"></script>

Setup

var callback = callback || function () {};
    
    cb = function(err) {
      var args = Array.prototype.slice.call(arguments, 1);
      if (args.length <= 1) {
        args = args[0];
      }
      callback.call(null, err, args);
    };
    
    fib = function(fn) {
      var numMax = 25
      for (i = 0, j = 1, k = 0; k < numMax; i = j, j = x, k++) {
        x = i + j;
        console.log(x);
      }
      fn(null, x);
    };
    
    COUNT = 50;
    
    list = [];
    for (var i = 0; i < COUNT; i++) {
      list.push(fib);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Normal
for (var i = 0; i < COUNT; i++) {
  fib(cb);
}
ready
Async.js
// async test
async.parallel(list, function() {
  deferred.resolve();
});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.