promise comparisons (v13)

Revision 13 of this benchmark created on


Description

This is a comparison of different promise libraries, performing the most basic tasks of creating a promise, adding a then handler and then resolving the promise.

Removed SLOW laissez-faire Removed avow which has bad code for checking module

Preparation HTML

<script src="http://mstade.github.com/promise-jsperf/javascripts/q.js"></script>
<script src="https://raw.github.com/dfilatov/jspromise/master/vow.min.js"></script>
<script src="https://code.jquery.com/jquery-2.0.0.min.js"></script>
<script src="http://olostan.org.ua/libs/when.js"></script>
<script src="https://raw.github.com/tildeio/rsvp.js/rsvp2/browser/rsvp.min.js"></script>
<script src="https://raw.github.com/gameclosure/ff/master/lib/ff.js"></script>

<script src="https://raw.github.com/caolan/async/master/lib/async.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
when
// async test
var d = when.defer()
d.promise.then(function done() {
  deferred.resolve()
})
d.resolve()
ready
q
// async test
var d = Q.defer()
d.promise.then(function done() {
  deferred.resolve()
})
d.resolve()
ready
jquery
// async test
var d = $.Deferred()
d.then(function done() {
  deferred.resolve()
})
d.resolve()
ready
Vow - jspromise
// async test
var vow = Vow.promise();
vow.then(function done() {
 deferred.resolve()
})
vow.fulfill()
ready
ff
// async test
var f = ff.defer();
f.then(function done() {
  deferred.resolve()
});
f();
ready
rsvp
// async test
var rs = new RSVP.Promise(function(resolve, reject){
  resolve();
});
rs.then(function done() {
  deferred.resolve();
});
 
ready
async
// async test
var work = [function(cb) {
  cb();
}];
async.series(work, function() {
  deferred.resolve();
});
ready
callback
// async test
var node = function(cb) {
  cb();
};

node(function(err) {
  deferred.resolve();
});
 
ready

Revisions

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