promise comparisons

JavaScript performance comparison

Revision 155 of this test case created by Ron Waldon

Preparation code

<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="http://jokeyrhy.me/js/lie-2.9.1.noConflict.min.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…

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