promise comparisons (v24)

Revision 24 of this benchmark created by JeanHuguesRobert 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.

Preparation HTML

<script src="https://rawgithub.com/NobleJS/setImmediate/master/setImmediate.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js"></script>
<script src="http://calvinmetcalf.github.io/promise-jsperf/javascripts/q.js"></script>
<script src="http://calvinmetcalf.github.io/promise-jsperf/javascripts/jQuery.js"></script>
<script src="http://medyk.org/deferred.js"></script>
<script>
    window.define = function(factory) {
        try{ delete window.define; } catch(e){ window.define = void 0; } // IE
        window.when = factory();
    };
    window.define.amd = {};
</script>
<script src="http://calvinmetcalf.github.io/promise-jsperf/javascripts/when.js"></script>
<script src="http://calvinmetcalf.github.io/promise-jsperf/javascripts/rsvp.js"></script>

<script src="http://calvinmetcalf.github.io/promise-jsperf/javascripts/promiscuous-browser.js"></script>
<script src="http://rawgithub.com/JeanHuguesRobert/l8/master/lib/whisper.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
promiscuous
// async test
var d = promiscuous.deferred();
d.promise.then(function done() {
  deferred.resolve()
})
d.resolve()
ready
when
// async test
var d = when.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
RSVP
// async test
var d = RSVP.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
dojo
// async test
var d = new dojo.Deferred();
d.then(function done() {
  deferred.resolve()
})
d.resolve();
ready
deferred
// async test
var d = medikooDeferred();
d.promise.then(function () {
  deferred.resolve();
})
d.resolve();
ready
Parole
// async test
var d = Parole();
d.then( function(){
  deferred.resolve();
});
d( null ) // eqv to d.resolve(), that works too
 
ready

Revisions

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