promise comparisons

JavaScript performance comparison

Revision 181 of this test case created by

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/q.js/1.4.1/q.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/when/2.7.1/when.min.js"></script>
<script src="https://mstade.github.com/promise-jsperf/javascripts/rsvp.js"></script>
<script src="https://mstade.github.com/promise-jsperf/javascripts/avow.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/2.9.27/bluebird.min.js"></script>
<script>var Bluebird = Promise.noConflict();</script>
<script src="https://cdn.rawgit.com/calvinmetcalf/lie/2.7.7/dist/lie.noConflict.js"></script>
    

Preparation code output

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
q
// async test
var d = Q.defer()
d.promise.then(function done() {
  deferred.resolve()
})
d.resolve()
pending…
native promise
// async test
var d = new Promise(function(resolve) {
  resolve();
});
d.then(function() {
  deferred.resolve();
});
pending…
Lie
// async test
var d = new Lie(function(resolve) {
  resolve();
});
d.then(function() {
  deferred.resolve();
});
pending…
RSVP
// async test
var p = new RSVP.Promise
p.then(function done() {
  deferred.resolve()
})
p.resolve()
pending…
avow
// async test
var v = avow()
v.promise.then(function done() {
  deferred.resolve()
})
v.fulfill()
pending…
Bluebird
// async test
var d = new Bluebird(function(resolve) {
  resolve();
});
d.then(function() {
  deferred.resolve();
});
pending…
JQuery
// async test
var d = new jQuery.Deferred(function(dfr) {
  dfr.resolve();
}).promise();
d.then(function() {
  deferred.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.

0 Comments