promise comparisons

JavaScript performance comparison

Revision 103 of this test case created

Info

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 code

<script src="//rawgithub.com/NobleJS/setImmediate/master/setImmediate.js">
</script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js">
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/q.js/0.9.2/q.min.js">
</script>
<script src="//calvinmetcalf.github.io/promise-jsperf/javascripts/jQuery.js">
</script>
<script src="//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="//calvinmetcalf.github.io/promise-jsperf/javascripts/when.js">
</script>
<script src="//calvinmetcalf.github.io/promise-jsperf/javascripts/rsvp.js">
</script>
<script src="//calvinmetcalf.github.io/promise-jsperf/javascripts/promiscuous.js">
</script>
<script src="//rawgithub.com/JeanHuguesRobert/l8/master/lib/whisper.js">
</script>
<script>
  if (typeof(require) == 'undefined') {
    require = null;
  }
  exports = {};
</script>
<script src="//rawgithub.com/kriszyp/promised-io/master/promise.js">
</script>
<script src="//rawgithub.com/Zolmeister/promiz/master/promiz.js"></script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
promiscuous
// async test
var d = promiscuous.deferred();
d.promise.then(function() {
  deferred.resolve()
})
d.resolve()
pending…
when
// async test
var d = when.defer()
d.promise.then(function() {
  deferred.resolve()
})
d.resolve()
pending…
jquery
// async test
var d = $.Deferred()
d.then(function() {
  deferred.resolve()
})
d.resolve()
pending…
RSVP
// async test
var d = RSVP.defer();
d.promise.then(function() {
  deferred.resolve()
})
d.resolve()
pending…
q
// async test
var d = Q.defer()
d.promise.then(function() {
  deferred.resolve()
})
d.resolve()
pending…
dojo
// async test
var d = new dojo.Deferred();
d.then(function() {
  deferred.resolve()
})
d.resolve();
pending…
deferred
// async test
var d = medikooDeferred();
d.promise.then(function() {
  deferred.resolve();
})
d.resolve();
pending…
Parole
// async test
var d = Parole();
d.then(function() {
  deferred.resolve();
});
d.resolve();
pending…
Promise/kriszyp
// async test
var d = exports.defer();
d.then(function() {
  deferred.resolve();
});
d.resolve();
pending…
Promiz
// async test
var d = Promiz.defer()
d.then(function() {
  deferred.resolve()
})
d.resolve()
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment